summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidgetItem.cpp')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
index 1b77b26..2c3b4b2 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
@@ -38,8 +38,8 @@ void QtTreeWidgetItem::setBackgroundColor(unsigned long color) {
(color & 0xFF));
}
-void QtTreeWidgetItem::setExpanded(bool b) {
- expanded_ = true;
+void QtTreeWidgetItem::setExpanded(bool expanded) {
+ expanded_ = expanded;
emit changed(this);
}
@@ -70,6 +70,7 @@ QWidget* QtTreeWidgetItem::getExpandedRosterWidget() {
}
QtTreeWidgetItem::~QtTreeWidgetItem() {
+ parent_->removeChild(this);
qDeleteAll(children_);
}
@@ -83,6 +84,11 @@ void QtTreeWidgetItem::addChild(QtTreeWidgetItem* child) {
handleChanged(child);
}
+void QtTreeWidgetItem::removeChild(QtTreeWidgetItem* child) {
+ children_.removeAll(child);
+ handleChanged(this);
+}
+
void QtTreeWidgetItem::handleChanged(QtTreeWidgetItem* child) {
shownChildren_.clear();
for (int i = 0; i < children_.size(); i++) {