diff options
author | Tomaz Canabrava <tcanabrava@kde.org> | 2013-05-13 21:39:49 -0500 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-13 21:45:06 -0500 |
commit | 6f74618d9c3907765633f6b6e17eb2ba5cd8f931 (patch) | |
tree | 54910c7edca1942115e1b2924d62c5401199da27 /qt-ui | |
parent | ee7f579242568d86e7ec744c17585066c30fa943 (diff) | |
download | subsurface-6f74618d9c3907765633f6b6e17eb2ba5cd8f931.tar.gz |
Speed fixes
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/divelistview.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index af0ef8b0c..2b579e1f0 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -50,25 +50,33 @@ void DiveListView::selectionChanged(const QItemSelection& selected, const QItemS struct dive *dive = (struct dive*) model->data(index, TreeItemDT::DIVE_ROLE).value<void*>(); if (!dive) { // is's a trip! if (model->rowCount(index)) { - expand(index); // leave this - even if it looks like it shouldn't be here. looks like I'v found a Qt bug. + expand(index); // leave this - even if it looks like it shouldn't be here. looks like I'v found a Qt bug. + // the subselection is removed, but the painting is not. this cleans the area. } } } + QList<QModelIndex> parents; Q_FOREACH(const QModelIndex& index, selected.indexes()) { const QAbstractItemModel *model = index.model(); struct dive *dive = (struct dive*) model->data(index, TreeItemDT::DIVE_ROLE).value<void*>(); if (!dive) { // is's a trip! if (model->rowCount(index)) { - expand(index); QItemSelection selection; selection.select(index.child(0,0), index.child(model->rowCount(index) -1 , 0)); selectionModel()->select(selection, QItemSelectionModel::Select | QItemSelectionModel::Rows); selectionModel()->setCurrentIndex(index, QItemSelectionModel::Select | QItemSelectionModel::NoUpdate); + if (!isExpanded(index)){ + expand(index); + } } } - else { - expand(index.parent()); + else if (!parents.contains(index.parent())){ + parents.push_back(index.parent()); } } + + Q_FOREACH(const QModelIndex& index, parents){ + expand(index); + } } |