diff options
| -rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 9921754..90be786 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -19,18 +19,20 @@ #include <QLayout> #include <QTabBar> #include <QApplication> #include <qdebug.h> namespace Swift { QtChatTabs::QtChatTabs() : QWidget() { #ifndef Q_WS_MAC setWindowIcon(QIcon(":/logo-chat-16.png")); +#else + setAttribute(Qt::WA_ShowWithoutActivating); #endif tabs_ = new QtTabWidget(this); tabs_->setUsesScrollButtons(true); tabs_->setElideMode(Qt::ElideRight); #if QT_VERSION >= 0x040500 /*For Macs, change the tab rendering.*/ tabs_->setDocumentMode(true); /*Closable tabs are only in Qt4.5 and later*/ @@ -264,14 +266,27 @@ void QtChatTabs::resizeEvent(QResizeEvent*) { emit geometryChanged(); } void QtChatTabs::moveEvent(QMoveEvent*) { emit geometryChanged(); } void QtChatTabs::checkForFirstShow() { if (!isVisible()) { +#ifndef Q_WS_MAC showMinimized(); +#else + /* https://bugreports.qt-project.org/browse/QTBUG-19194 + * ^ When the above is fixed we can swap the below for just show(); + * WA_ShowWithoutActivating seems to helpfully not work, so... */ + + QWidget* currentWindow = QApplication::activeWindow(); /* Remember who had focus if we're the current application*/ + show(); + QCoreApplication::processEvents(); /* Run through the eventloop to clear the show() */ + if (currentWindow) { + currentWindow->activateWindow(); /* Set focus back */ + } +#endif } } } |
Swift