diff options
Diffstat (limited to 'src/gui/group/GroupView.cpp')
-rw-r--r-- | src/gui/group/GroupView.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/gui/group/GroupView.cpp b/src/gui/group/GroupView.cpp index 33c591696..056015ca8 100644 --- a/src/gui/group/GroupView.cpp +++ b/src/gui/group/GroupView.cpp @@ -38,9 +38,10 @@ GroupView::GroupView(Database* db, QWidget* parent) // clang-format off connect(this, SIGNAL(expanded(QModelIndex)), SLOT(expandedChanged(QModelIndex))); connect(this, SIGNAL(collapsed(QModelIndex)), SLOT(expandedChanged(QModelIndex))); + connect(this, SIGNAL(clicked(QModelIndex)), SIGNAL(groupSelectionChanged())); connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int))); connect(m_model, SIGNAL(modelReset()), SLOT(modelReset())); - connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(emitGroupChanged())); + connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SIGNAL(groupSelectionChanged())); // clang-format on new QShortcut(Qt::CTRL + Qt::Key_F10, this, SLOT(contextMenuShortcutPressed()), nullptr, Qt::WidgetShortcut); @@ -85,7 +86,7 @@ void GroupView::dragMoveEvent(QDragMoveEvent* event) void GroupView::focusInEvent(QFocusEvent* event) { - emitGroupChanged(); + emit groupFocused(); QTreeView::focusInEvent(event); } @@ -140,11 +141,6 @@ void GroupView::setModel(QAbstractItemModel* model) Q_ASSERT(false); } -void GroupView::emitGroupChanged() -{ - emit groupSelectionChanged(currentGroup()); -} - void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end) { for (int row = start; row <= end; row++) { @@ -155,10 +151,11 @@ void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end) void GroupView::setCurrentGroup(Group* group) { - if (group == nullptr) + if (group == nullptr) { setCurrentIndex(QModelIndex()); - else + } else { setCurrentIndex(m_model->index(group)); + } } void GroupView::modelReset() |