summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index cd3aada..f52a3fe 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -1,12 +1,10 @@
-#pragma once
-
#include "QtChatTabs.h"
#include <QTabWidget>
#include <QLayout>
namespace Swift {
-QtChatTabs::QtChatTabs() {
+QtChatTabs::QtChatTabs() : QWidget() {
tabs_ = new QTabWidget(this);
#if QT_VERSION >= 0x040500
//For Macs, change the tab rendering.
@@ -20,12 +18,25 @@ QtChatTabs::QtChatTabs() {
resize(400, 300);
}
-void QtChatTabs::addTab(QWidget* tab) {
+void QtChatTabs::addTab(QtTabbable* tab) {
tabs_->addTab(tab, tab->windowTitle());
+ connect(tab, SIGNAL(titleUpdated()), this, SLOT(tabTitleUpdated()));
}
void QtChatTabs::tabClosing() {
}
+void QtChatTabs::tabTitleUpdated() {
+ QWidget* widget = qobject_cast<QWidget*>(sender());
+ if (!widget) {
+ return;
+ }
+ int index = tabs_->indexOf(widget);
+ if (index < 0) {
+ return;
+ }
+ tabs_->setTabText(index, widget->windowTitle());
+}
+
} \ No newline at end of file