diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-25 19:56:36 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-25 19:56:36 (GMT) |
commit | ee9eff16cd7024bdbd889bab7612c63bcfe3cbe9 (patch) | |
tree | d71842bf0c48c7163b8e67f42126d7f4c72fd3e4 /Swift/QtUI/QtChatTabs.cpp | |
parent | 1934734a0a0ef46d5db2eeedfb380a269116e3b4 (diff) | |
download | swift-contrib-ee9eff16cd7024bdbd889bab7612c63bcfe3cbe9.zip swift-contrib-ee9eff16cd7024bdbd889bab7612c63bcfe3cbe9.tar.bz2 |
Support Ctrl-PgUp/PgDn for switch ing tabs
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index d327e7c..a7698c2 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -51,6 +51,8 @@ void QtChatTabs::addTab(QtTabbable* tab) { connect(tab, SIGNAL(windowClosing()), this, SLOT(handleTabClosing())); connect(tab, SIGNAL(windowOpening()), this, SLOT(handleWidgetShown())); connect(tab, SIGNAL(wantsToActivate()), this, SLOT(handleWantsToActivate())); + connect(tab, SIGNAL(requestNextTab()), this, SLOT(handleRequestedNextTab())); + connect(tab, SIGNAL(requestPreviousTab()), this, SLOT(handleRequestedPreviousTab())); } void QtChatTabs::handleWidgetShown() { @@ -95,6 +97,18 @@ void QtChatTabs::handleTabClosing() { handleTabTitleUpdated(tabs_->currentWidget()); } +void QtChatTabs::handleRequestedPreviousTab() { + int newIndex = tabs_->currentIndex() - 1; + tabs_->setCurrentIndex(newIndex >= 0 ? newIndex : tabs_->count() - 1); +} + +void QtChatTabs::handleRequestedNextTab() { + int newIndex = tabs_->currentIndex() + 1; + tabs_->setCurrentIndex(newIndex < tabs_->count() ? newIndex : 0); + +} + + void QtChatTabs::handleTabCloseRequested(int index) { QWidget* widget = tabs_->widget(index); widget->close(); |