diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-26 16:29:44 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-26 17:24:07 (GMT) |
commit | e497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4 (patch) | |
tree | e2fbb5b2c5f4b5fe3aa884bf551379ac2c6478c8 /Swift/QtUI/Roster/QtTreeWidget.cpp | |
parent | c77cbf3d4cdcfce47639006f023715483f6f0dc1 (diff) | |
download | swift-contrib-e497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4.zip swift-contrib-e497af7cd28d2cf58d81ed8fd351b5d5ccfa56a4.tar.bz2 |
Don't let roster groups open and close on their own.
Resolves: #368
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidget.cpp')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 997c1f6..6ace3df 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -100,32 +100,16 @@ void QtTreeWidget::handleCollapsed(const QModelIndex& index) { } void QtTreeWidget::handleModelItemExpanded(const QModelIndex& index, bool shouldExpand) { - if (this->isExpanded(index) == shouldExpand) { + if (!index.isValid()) { return; } - //setExpanded(index, shouldExpand); - if (shouldExpand) { - expand(index); - emit expanded(index); - } else { - collapse(index); - emit collapsed(index); + bool alreadyRight = this->isExpanded(index) == shouldExpand; + if (alreadyRight) { + return; } + setExpanded(index, shouldExpand); } -// void QtTreeWidget::handleDataChanged(const QModelIndex& topLeft, const QModelIndex& /*bottomRight*/) { -// //in our model, this is only thrown with topLeft == bottomRight -// if (!topLeft.isValid()) { -// return; -// } -// QtTreeWidgetItem* qtItem = static_cast<QtTreeWidgetItem*>(topLeft.internalPointer()); -// if (qtItem) { -// setExpanded(topLeft, qtItem->isExpanded()); -// //qDebug() << "Item changed, passing expanded state to view: " << qtItem->isExpanded() << " giving an expanded state of " << isExpanded(topLeft); -// } - -// } - void QtTreeWidget::drawBranches(QPainter*, const QRect&, const QModelIndex&) const { } |