summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index a896dc9..e79b2ef 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -1,6 +1,7 @@
#include "QtChatTabs.h"
#include <QCloseEvent>
+#include <QtGlobal>
#include <QTabWidget>
#include <QLayout>
@@ -36,6 +37,7 @@ void QtChatTabs::addTab(QtTabbable* tab) {
connect(tab, SIGNAL(titleUpdated()), this, SLOT(handleTabTitleUpdated()));
connect(tab, SIGNAL(windowClosing()), this, SLOT(handleTabClosing()));
connect(tab, SIGNAL(windowOpening()), this, SLOT(handleWidgetShown()));
+ connect(tab, SIGNAL(wantsToActivate()), this, SLOT(handleWantsToActivate()));
}
void QtChatTabs::handleWidgetShown() {
@@ -50,6 +52,15 @@ void QtChatTabs::handleWidgetShown() {
show();
}
+void QtChatTabs::handleWantsToActivate() {
+ QtTabbable* widget = qobject_cast<QtTabbable*>(sender());
+ Q_ASSERT(widget);
+ Q_ASSERT(tabs_->indexOf(widget) >= 0);
+ //Un-minimize and bring to front.
+ setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
+ tabs_->setCurrentWidget(widget);
+}
+
void QtChatTabs::handleTabClosing() {
QWidget* widget = qobject_cast<QWidget*>(sender());
if (!widget) {