diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-08-08 14:39:06 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-08-08 14:39:06 (GMT) |
commit | f948f047401021f3afc8a015991fc81e7d69d6ce (patch) | |
tree | 3839396c7889d7695dd58cd350efd6612a02c570 /Swift/QtUI | |
parent | 47d75bf5a3f58ce582e5715a9d5ba6e89a38b033 (diff) | |
download | swift-f948f047401021f3afc8a015991fc81e7d69d6ce.zip swift-f948f047401021f3afc8a015991fc81e7d69d6ce.tar.bz2 |
Group expandedness in roster persists between roster changes.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/Roster/RosterModel.cpp | 18 | ||||
-rw-r--r-- | Swift/QtUI/Roster/RosterModel.h | 1 |
2 files changed, 3 insertions, 16 deletions
diff --git a/Swift/QtUI/Roster/RosterModel.cpp b/Swift/QtUI/Roster/RosterModel.cpp index 30d8135..1df2117 100644 --- a/Swift/QtUI/Roster/RosterModel.cpp +++ b/Swift/QtUI/Roster/RosterModel.cpp @@ -19,15 +19,12 @@ void RosterModel::handleItemChanged(QtTreeWidgetItem* item) { if (!item->isShown()) { return; } - //these two lines should be redundant, but... - reset(); - emit layoutChanged(); - //These lines don't seem to be enough Q_ASSERT(item); QModelIndex modelIndex = index(item); + Q_ASSERT(modelIndex.isValid()); emit itemExpanded(modelIndex, item->isExpanded()); emit dataChanged(modelIndex, modelIndex); - + emit layoutChanged(); } int RosterModel::columnCount(const QModelIndex& parent) const { @@ -48,18 +45,9 @@ QModelIndex RosterModel::index(int row, int column, const QModelIndex& parent) c } QModelIndex RosterModel::index(QtTreeWidgetItem* item) const { - QtTreeWidgetItem* parentItem = item->getParentItem(); - Q_ASSERT(parentItem); - QModelIndex parentIndex = parent(item); - return index(item->row(), 0, parentIndex); + return createIndex(item->row(), 0, item); } -QModelIndex RosterModel::parent(QtTreeWidgetItem* item) const { - QtTreeWidgetItem* parentItem = item->getParentItem(); - return parentItem == tree_ ? QModelIndex() : index(parentItem->row(), 0, parent(parentItem)); -} - - QModelIndex RosterModel::parent(const QModelIndex& index) const { if (!index.isValid()) { return QModelIndex(); diff --git a/Swift/QtUI/Roster/RosterModel.h b/Swift/QtUI/Roster/RosterModel.h index c1d998c..fc9b1f3 100644 --- a/Swift/QtUI/Roster/RosterModel.h +++ b/Swift/QtUI/Roster/RosterModel.h @@ -17,7 +17,6 @@ public: QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; QModelIndex index(QtTreeWidgetItem* item) const; QModelIndex parent(const QModelIndex& index) const; - QModelIndex parent(QtTreeWidgetItem* item) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; signals: void itemExpanded(const QModelIndex& item, bool expanded); |