summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-08-08 14:39:06 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-08-08 14:39:06 (GMT)
commitf948f047401021f3afc8a015991fc81e7d69d6ce (patch)
tree3839396c7889d7695dd58cd350efd6612a02c570 /Swift/QtUI/Roster/RosterModel.cpp
parent47d75bf5a3f58ce582e5715a9d5ba6e89a38b033 (diff)
downloadswift-f948f047401021f3afc8a015991fc81e7d69d6ce.zip
swift-f948f047401021f3afc8a015991fc81e7d69d6ce.tar.bz2
Group expandedness in roster persists between roster changes.
Diffstat (limited to 'Swift/QtUI/Roster/RosterModel.cpp')
-rw-r--r--Swift/QtUI/Roster/RosterModel.cpp18
1 files changed, 3 insertions, 15 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();