Connect to selectionModel()->currentChanged() instead of reimplementing currentChanged().

This commit is contained in:
Felix Geyer 2012-05-14 16:50:28 +02:00
parent 120be979e9
commit 10e24e7343
2 changed files with 2 additions and 8 deletions

View File

@ -37,6 +37,8 @@ GroupView::GroupView(Database* db, QWidget* parent)
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(expandedChanged(QModelIndex))); connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int))); connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int)));
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(emitGroupChanged()));
setCurrentIndex(m_model->index(0, 0)); setCurrentIndex(m_model->index(0, 0));
// invoke later so the EntryView is connected // invoke later so the EntryView is connected
QMetaObject::invokeMethod(this, "emitGroupChanged", Qt::QueuedConnection, QMetaObject::invokeMethod(this, "emitGroupChanged", Qt::QueuedConnection,
@ -113,13 +115,6 @@ void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end)
} }
} }
void GroupView::currentChanged(const QModelIndex &current, const QModelIndex &previous)
{
Q_UNUSED(current);
Q_UNUSED(previous);
emitGroupChanged();
}
void GroupView::setCurrentGroup(Group* group) void GroupView::setCurrentGroup(Group* group)
{ {
setCurrentIndex(m_model->index(group)); setCurrentIndex(m_model->index(group));

View File

@ -43,7 +43,6 @@ private Q_SLOTS:
void emitGroupChanged(const QModelIndex& index); void emitGroupChanged(const QModelIndex& index);
void emitGroupChanged(); void emitGroupChanged();
void syncExpandedState(const QModelIndex& parent, int start, int end); void syncExpandedState(const QModelIndex& parent, int start, int end);
void currentChanged(const QModelIndex &current, const QModelIndex &previous);
protected: protected:
void dragMoveEvent(QDragMoveEvent* event); void dragMoveEvent(QDragMoveEvent* event);