summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-08-08 14:18:43 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-08-08 14:18:43 (GMT)
commit47d75bf5a3f58ce582e5715a9d5ba6e89a38b033 (patch)
tree20345d9b84af4650076440e6a2f57a4661143ca4 /Swift/QtUI/Roster/QtTreeWidgetItem.cpp
parent40d35626023f12d8ebea3a53672968b1b80f5974 (diff)
downloadswift-47d75bf5a3f58ce582e5715a9d5ba6e89a38b033.zip
swift-47d75bf5a3f58ce582e5715a9d5ba6e89a38b033.tar.bz2
Plumbing in place for roster group expansion. \nDoesn't work.
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidgetItem.cpp')
-rw-r--r--Swift/QtUI/Roster/QtTreeWidgetItem.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
index aa1836c..1b77b26 100644
--- a/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
+++ b/Swift/QtUI/Roster/QtTreeWidgetItem.cpp
@@ -8,6 +8,7 @@ namespace Swift {
QtTreeWidgetItem::QtTreeWidgetItem(QtTreeWidgetItem* parentItem) : QObject(), textColor_(0,0,0), backgroundColor_(255,255,255) {
parent_ = parentItem;
shown_ = true;
+ expanded_ = true;
}
void QtTreeWidgetItem::setText(const String& text) {
@@ -38,17 +39,18 @@ void QtTreeWidgetItem::setBackgroundColor(unsigned long color) {
}
void QtTreeWidgetItem::setExpanded(bool b) {
- //treeWidget()->setItemExpanded(this, b);
+ expanded_ = true;
+ emit changed(this);
}
void QtTreeWidgetItem::hide() {
shown_ = false;
- emit changed();
+ emit changed(this);
}
void QtTreeWidgetItem::show() {
shown_ = true;
- emit changed();
+ emit changed(this);
}
bool QtTreeWidgetItem::isShown() {
@@ -77,18 +79,18 @@ QtTreeWidgetItem* QtTreeWidgetItem::getParentItem() {
void QtTreeWidgetItem::addChild(QtTreeWidgetItem* child) {
children_.append(child);
- connect(child, SIGNAL(changed()), this, SLOT(handleChanged()));
- handleChanged();
+ connect(child, SIGNAL(changed(QtTreeWidgetItem*)), this, SLOT(handleChanged(QtTreeWidgetItem*)));
+ handleChanged(child);
}
-void QtTreeWidgetItem::handleChanged() {
+void QtTreeWidgetItem::handleChanged(QtTreeWidgetItem* child) {
shownChildren_.clear();
for (int i = 0; i < children_.size(); i++) {
if (children_[i]->isShown()) {
shownChildren_.append(children_[i]);
}
}
- emit changed();
+ emit changed(child);
}
int QtTreeWidgetItem::rowCount() {
@@ -106,6 +108,8 @@ int QtTreeWidgetItem::row() {
QtTreeWidgetItem* QtTreeWidgetItem::getItem(int row) {
//qDebug() << "Returning row " << row << " from item " << displayName_;
+ Q_ASSERT(row >= 0);
+ Q_ASSERT(row < rowCount());
return shownChildren_[row];
}
@@ -125,4 +129,8 @@ bool QtTreeWidgetItem::isContact() {
return children_.size() == 0;
}
+bool QtTreeWidgetItem::isExpanded() {
+ return expanded_;
+}
+
} \ No newline at end of file