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:
aldelaro5 2018-05-04 23:38:13 -04:00
parent f9a6f97dca
commit 8c23335be3
No known key found for this signature in database
GPG Key ID: 054DD3E6FF48DB71
1 changed files with 95 additions and 98 deletions

View File

@ -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(); });