summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp11
-rw-r--r--Swift/QtUI/QtChatTabs.h3
-rw-r--r--Swift/QtUI/QtChatWindow.cpp1
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();
}
}