Skip to content

Commit

Permalink
GH-2101 fix enter and double click activation of instances
Browse files Browse the repository at this point in the history
  • Loading branch information
peterix committed Nov 22, 2018
1 parent c214c13 commit 74c598d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion application/MainWindow.cpp
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions application/groupview/GroupView.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 74c598d

Please sign in to comment.