summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2018-11-22 02:02:53 +0100
committerPetr Mrázek <peterix@gmail.com>2018-11-22 02:02:53 +0100
commit74c598d756107be817989d87bd4ccf9d1a182e90 (patch)
tree00659a8f01f9b00879701ecef0703d00168232dd
parentc214c13fb353ef68718e7bca6fd784037d262c91 (diff)
downloadMultiMC-74c598d756107be817989d87bd4ccf9d1a182e90.tar
MultiMC-74c598d756107be817989d87bd4ccf9d1a182e90.tar.gz
MultiMC-74c598d756107be817989d87bd4ccf9d1a182e90.tar.lz
MultiMC-74c598d756107be817989d87bd4ccf9d1a182e90.tar.xz
MultiMC-74c598d756107be817989d87bd4ccf9d1a182e90.zip
GH-2101 fix enter and double click activation of instances
-rw-r--r--application/MainWindow.cpp2
-rw-r--r--application/groupview/GroupView.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index 66e1f141..78b0a907 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -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);
diff --git a/application/groupview/GroupView.cpp b/application/groupview/GroupView.cpp
index a1b44e64..e61ac898 100644
--- a/application/groupview/GroupView.cpp
+++ b/application/groupview/GroupView.cpp
@@ -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)