diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-06-18 16:56:21 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-06-18 16:56:21 (GMT) |
commit | 8e517721c88f22774224766dba4105fcb723fa91 (patch) | |
tree | 5433d13723b5865321a26e8655ba2ed881002107 /Swift/QtUI | |
parent | ab5fcc8ad6447a4b3578eb84c1ec3a975ec62d4c (diff) | |
download | swift-8e517721c88f22774224766dba4105fcb723fa91.zip swift-8e517721c88f22774224766dba4105fcb723fa91.tar.bz2 |
It should be impossible to lose tabs now.
You can still have an empty tabset, though.
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 11 | ||||
-rw-r--r-- | Swift/QtUI/QtChatTabs.h | 3 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 1 |
3 files changed, 15 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 24828fc..e1f4e86 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -1,5 +1,6 @@ #include "QtChatTabs.h" +#include <QCloseEvent> #include <QTabWidget> #include <QLayout> @@ -21,6 +22,15 @@ QtChatTabs::QtChatTabs() : QWidget() { resize(400, 300); } +void QtChatTabs::closeEvent(QCloseEvent* event) { + //Hide first to prevent flickering as each tab is removed. + hide(); + for (int i = tabs_->count() - 1; i >= 0; i--) { + tabs_->removeTab(i); + } + event->accept(); +} + void QtChatTabs::addTab(QtTabbable* tab) { tabs_->addTab(tab, tab->windowTitle()); connect(tab, SIGNAL(titleUpdated()), this, SLOT(handleTabTitleUpdated())); @@ -37,6 +47,7 @@ void QtChatTabs::handleWidgetShown() { return; } addTab(widget); + show(); } void QtChatTabs::handleTabClosing() { diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h index 7534c5a..97967c9 100644 --- a/Swift/QtUI/QtChatTabs.h +++ b/Swift/QtUI/QtChatTabs.h @@ -11,6 +11,9 @@ namespace Swift { QtChatTabs(); void addTab(QtTabbable* tab); + protected slots: + void closeEvent(QCloseEvent* event); + private slots: void handleTabClosing(); void handleTabTitleUpdated(); diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 6442f8e..5b63e55 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -182,6 +182,7 @@ void QtChatWindow::returnPressed() { void QtChatWindow::show() { QWidget::show(); + emit windowOpening(); } } |