GH-2101 fix enter and double click activation of instances

This commit is contained in:
Petr Mrázek 2018-11-22 02:02:53 +01:00
parent c214c13fb3
commit 74c598d756
2 changed files with 7 additions and 1 deletions

View File

@ -692,7 +692,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
setCatBackground(cat_enable);
}
// start instance when double-clicked
connect(view, &GroupView::doubleClicked, this, &MainWindow::instanceActivated);
connect(view, &GroupView::activated, this, &MainWindow::instanceActivated);
// track the selection -- update the instance toolbar
connect(view->selectionModel(), &QItemSelectionModel::currentChanged, this, &MainWindow::instanceChanged);

View File

@ -417,6 +417,12 @@ void GroupView::mouseDoubleClickEvent(QMouseEvent *event)
// signal handlers may change the model
QPersistentModelIndex persistent = index;
emit doubleClicked(persistent);
QStyleOptionViewItem option = viewOptions();
if ((model()->flags(index) & Qt::ItemIsEnabled) && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
{
emit activated(index);
}
}
void GroupView::paintEvent(QPaintEvent *event)