summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidget.cpp')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidget.cpp26
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 {
}