summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Roster')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp10
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.h1
2 files changed, 9 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++) {
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.h b/Swift/QtUI/Roster/QtTreeWidgetItem.h
index 73da92f..20e6f5d 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.h
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.h
@@ -26,6 +26,7 @@ class QtTreeWidgetItem : public QObject, public TreeWidgetItem {
public:
~QtTreeWidgetItem();
void addChild(QtTreeWidgetItem* child);
+ void removeChild(QtTreeWidgetItem* child);
QtTreeWidgetItem* getParentItem();
int rowCount();
int rowOf(QtTreeWidgetItem* item);