diff options
Diffstat (limited to 'Swift/QtUI/Roster/QtTreeWidget.cpp')
-rw-r--r-- | Swift/QtUI/Roster/QtTreeWidget.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 714beb2..67afd14 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -19,7 +19,7 @@ QtTreeWidget::QtTreeWidget(QWidget* parent) : QTreeView(parent) { setAnimated(true); setIndentation(0); setRootIsDecorated(true); - //connect(this, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(handleItemActivated(QTreeWidgetItem*, int))); + connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&))); } QtTreeWidget::~QtTreeWidget() { @@ -31,12 +31,12 @@ QtTreeWidgetItem* QtTreeWidget::getRoot() { return treeRoot_; } -// void QtTreeWidget::handleItemActivated(QTreeWidgetItem* item, int column) { -// QtTreeWidgetItem* qtItem = dynamic_cast<QtTreeWidgetItem*>(item); -// if (qtItem) { -// qtItem->performUserAction(boost::shared_ptr<UserRosterAction>(new OpenChatRosterAction())); -// } -// } +void QtTreeWidget::handleItemActivated(const QModelIndex& index) { + QtTreeWidgetItem* qtItem = static_cast<QtTreeWidgetItem*>(index.internalPointer()); + if (qtItem) { + qtItem->performUserAction(boost::shared_ptr<UserRosterAction>(new OpenChatRosterAction())); + } +} void QtTreeWidget::drawBranches(QPainter*, const QRect&, const QModelIndex&) const { } |