diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/ChatList/QtChatListWindow.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 8dbb501..5943078 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -26,7 +26,7 @@ QtChatListWindow::QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent delegate_ = new ChatListDelegate(); setItemDelegate(delegate_); setHeaderHidden(true); - #ifdef SWIFT_PLATFORM_MACOSX +#ifdef SWIFT_PLATFORM_MACOSX setAlternatingRowColors(true); #endif expandAll(); @@ -35,6 +35,7 @@ QtChatListWindow::QtChatListWindow(UIEventStream *uiEventStream, QWidget* parent setRootIsDecorated(true); setupContextMenus(); connect(this, SIGNAL(activated(const QModelIndex&)), this, SLOT(handleItemActivated(const QModelIndex&))); + connect(this, SIGNAL(clicked(const QModelIndex&)), this, SLOT(handleClicked(const QModelIndex&))); } QtChatListWindow::~QtChatListWindow() { @@ -44,6 +45,13 @@ QtChatListWindow::~QtChatListWindow() { delete emptyMenu_; } +void QtChatListWindow::handleClicked(const QModelIndex& index) { + ChatListGroupItem* item = dynamic_cast<ChatListGroupItem*>(static_cast<ChatListItem*>(index.internalPointer())); + if (item) { + setExpanded(index, !isExpanded(index)); + } +} + void QtChatListWindow::setupContextMenus() { mucMenu_ = new QMenu(); mucMenu_->addAction("Add New Bookmark", this, SLOT(handleAddBookmark())); diff --git a/Swift/QtUI/ChatList/QtChatListWindow.h b/Swift/QtUI/ChatList/QtChatListWindow.h index 7d0dbb1..1215f83 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.h +++ b/Swift/QtUI/ChatList/QtChatListWindow.h @@ -28,6 +28,7 @@ namespace Swift { void handleAddBookmark(); void handleEditBookmark(); void handleRemoveBookmark(); + void handleClicked(const QModelIndex& index); protected: void contextMenuEvent(QContextMenuEvent* event); |