Qt/RegisterView: fix the context menu not working correctly
It seemed impossible to SELECT an item, however, when right clicking, the CURRENT item is set to the appropriate cell, this commit makes the view use thta cell instead of the first selected one.
This commit is contained in:
parent
f9a6f97dca
commit
8c23335be3
|
@ -108,13 +108,11 @@ void RegisterWidget::ShowContextMenu()
|
|||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
|
||||
if (m_table->selectedItems().size())
|
||||
{
|
||||
auto variant = m_table->selectedItems()[0]->data(DATA_TYPE);
|
||||
auto variant = m_table->currentItem()->data(DATA_TYPE);
|
||||
|
||||
if (!variant.isNull())
|
||||
{
|
||||
auto* item = reinterpret_cast<RegisterColumn*>(m_table->selectedItems()[0]);
|
||||
auto* item = static_cast<RegisterColumn*>(m_table->currentItem());
|
||||
auto type = static_cast<RegisterType>(item->data(DATA_TYPE).toInt());
|
||||
auto display = item->GetDisplay();
|
||||
|
||||
|
@ -210,7 +208,6 @@ void RegisterWidget::ShowContextMenu()
|
|||
|
||||
menu->addSeparator();
|
||||
}
|
||||
}
|
||||
|
||||
AddAction(menu, tr("Update"), this, [this] { emit RequestTableUpdate(); });
|
||||
|
||||
|
|
Loading…
Reference in New Issue