diff --git a/src/blackgui/components/cockpitinfoareacomponent.ui b/src/blackgui/components/cockpitinfoareacomponent.ui index 141587b32..a95d27b9c 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.ui +++ b/src/blackgui/components/cockpitinfoareacomponent.ui @@ -7,7 +7,7 @@ 0 0 161 - 67 + 55 @@ -58,16 +58,16 @@ 8 - - + + - 3 + 0 0 - 2 + 0 0 @@ -76,13 +76,43 @@ 0 - + - QFrame::StyledPanel + QFrame::NoFrame - QFrame::Raised + QFrame::Plain + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + @@ -110,16 +140,16 @@ 8 - - + + - 3 + 0 0 - 2 + 0 0 @@ -128,13 +158,43 @@ 0 - + - QFrame::StyledPanel + QFrame::NoFrame - QFrame::Raised + QFrame::Plain + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + diff --git a/src/blackgui/components/maininfoareacomponent.ui b/src/blackgui/components/maininfoareacomponent.ui index 3df7d51cc..8f263e52a 100644 --- a/src/blackgui/components/maininfoareacomponent.ui +++ b/src/blackgui/components/maininfoareacomponent.ui @@ -6,16 +6,10 @@ 0 0 - 1266 - 55 + 1533 + 242 - - - 0 - 0 - - Main info area @@ -65,8 +59,8 @@ 4 - - + + 0 @@ -83,7 +77,37 @@ 0 - + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + @@ -91,8 +115,8 @@ - 127 - 38 + 165 + 66 @@ -107,14 +131,8 @@ 4 - - - - 0 - 0 - - - + + 0 @@ -122,7 +140,7 @@ 0 - 2 + 0 0 @@ -131,19 +149,49 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame - - - 0 - 0 - + + QFrame::Raised + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + @@ -152,8 +200,8 @@ - 127 - 38 + 165 + 66 @@ -168,14 +216,14 @@ 4 - + 0 0 - + 0 @@ -183,7 +231,7 @@ 0 - 2 + 0 0 @@ -192,19 +240,49 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame - - - 0 - 0 - + + QFrame::Plain + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + @@ -213,8 +291,8 @@ - 127 - 38 + 163 + 64 @@ -226,8 +304,8 @@ 4 - - + + 0 @@ -235,7 +313,7 @@ 0 - 2 + 0 0 @@ -244,13 +322,43 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + @@ -260,7 +368,7 @@ 127 - 38 + 50 @@ -272,8 +380,8 @@ 4 - - + + 0 @@ -281,7 +389,7 @@ 0 - 2 + 0 0 @@ -308,8 +416,8 @@ - 127 - 38 + 165 + 66 @@ -321,8 +429,8 @@ 4 - - + + 0 @@ -330,7 +438,7 @@ 0 - 2 + 0 0 @@ -339,13 +447,43 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + @@ -354,8 +492,8 @@ - 127 - 38 + 165 + 66 @@ -367,16 +505,13 @@ 4 - - - - 0 - + + 0 - 2 + 0 0 @@ -385,13 +520,43 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + @@ -401,7 +566,7 @@ 80 - 38 + 50 @@ -413,7 +578,7 @@ 4 - + 0 @@ -437,7 +602,7 @@ 0 - + QFrame::NoFrame @@ -447,16 +612,28 @@ 0 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + - + - 127 - 38 + 165 + 66 @@ -468,8 +645,8 @@ 4 - - + + 0 @@ -477,7 +654,7 @@ 0 - 2 + 0 0 @@ -486,13 +663,43 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + @@ -502,7 +709,7 @@ 80 - 38 + 70 @@ -514,8 +721,8 @@ 4 - - + + 0 @@ -523,7 +730,7 @@ 0 - 2 + 0 0 @@ -532,7 +739,7 @@ 0 - + QFrame::NoFrame @@ -542,6 +749,36 @@ 0 + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + @@ -550,8 +787,8 @@ - 127 - 38 + 165 + 66 @@ -563,8 +800,8 @@ 4 - - + + 0 @@ -572,7 +809,7 @@ 0 - 2 + 0 0 @@ -581,13 +818,43 @@ 0 - - - - 0 - 0 - + + + QFrame::NoFrame + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 2 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp index ecc5a357b..5bf48cf20 100644 --- a/src/blackgui/dockwidget.cpp +++ b/src/blackgui/dockwidget.cpp @@ -104,13 +104,13 @@ namespace BlackGui void CDockWidget::displayStatusMessage(const BlackMisc::CStatusMessage &statusMessage) { - if (!this->isFloating()) { return; } + if (!this->m_allowStatusBar || !this->isFloating()) { return; } this->m_statusBar.displayStatusMessage(statusMessage); } void CDockWidget::displayStatusMessages(const BlackMisc::CStatusMessageList &statusMessages) { - if (!this->isFloating()) { return; } + if (!this->m_allowStatusBar || !this->isFloating()) { return; } this->m_statusBar.displayStatusMessages(statusMessages); } @@ -173,8 +173,7 @@ namespace BlackGui this->resize(innerWidget->size()); } - //! \todo CDockWidget, check if style sheet reload is needed - this->ps_onStyleSheetsChanged(); // force style sheet reload + this->forceStyleSheetUpdate(); // force style sheet reload } void CDockWidget::toggleFloating() @@ -336,7 +335,14 @@ namespace BlackGui QDockWidget::setWindowTitle(this->m_windowTitleBackup); } this->setNullTitleBarWidget(); - if (!this->m_wasAlreadyFloating) { this->initialFloating(); } + if (!this->m_wasAlreadyFloating) + { + this->initialFloating(); + } + else + { + if (m_wasFrameless) { setFrameless(true); } + } this->setContentsMargins( this->isFrameless() ? @@ -380,13 +386,24 @@ namespace BlackGui if (!this->m_allowStatusBar) { return; } this->m_statusBar.initStatusBar(); - QWidget *innerWidget = this->widget(); // the inner widget containing the layout - Q_ASSERT(innerWidget); - if (!innerWidget) { return; } + // we expect the following hierarchy + // QDockWidget (CDockWidget/CDockWidgetInfoArea) -> QWidget (outer widget) -> QFrame (inner widget) + // Structure used for frameless floating windows + + QWidget *outerWidget = this->widget(); // the inner widget containing the layout + Q_ASSERT_X(outerWidget, "CDockWidget::initStatusBar", "No outer widget"); + Q_ASSERT_X(outerWidget->layout(), "CDockWidget::initStatusBar", "No outer widget layout"); + Q_ASSERT_X(outerWidget->layout()->itemAt(0) && outerWidget->layout()->itemAt(0)->widget(), "CDockWidget::initStatusBar", "No outer widget layout item"); + if (!outerWidget || !outerWidget->layout() || !outerWidget->layout()->itemAt(0) || !outerWidget->layout()->itemAt(0)->widget()) { this->m_allowStatusBar = false; return; } + + // Inner widget is supposed to be a QFrame / promoted QFrame + QFrame *innerWidget = qobject_cast(outerWidget->layout()->itemAt(0)->widget()); // the inner widget containing the layout + Q_ASSERT_X(innerWidget, "CDockWidget::initStatusBar", "No inner widget"); + if (!innerWidget) { this->m_allowStatusBar = false; return; } QVBoxLayout *vLayout = qobject_cast(innerWidget->layout()); - Q_ASSERT(vLayout); - if (!vLayout) { return; } - vLayout->addWidget(this->m_statusBar.getStatusBar(), 0, Qt::AlignBottom); + Q_ASSERT_X(vLayout, "CDockWidget::initStatusBar", "No outer widget layout"); + if (!vLayout) { this->m_allowStatusBar = false; return; } + vLayout->addWidget(this->m_statusBar.getStatusBar(), 0, Qt::AlignBottom); // 0->vertical stretch minimum // adjust stretching of the original widget. It was the only widget so far // and should occupy maximum space @@ -414,6 +431,13 @@ namespace BlackGui void CDockWidget::ps_onStyleSheetsChanged() { - this->update(); } + + void CDockWidget::forceStyleSheetUpdate() + { + QString qss = this->styleSheet(); + this->setStyleSheet(qss.isEmpty() ? " " : ""); + this->setStyleSheet(qss); + } + } // namespace diff --git a/src/blackgui/dockwidget.h b/src/blackgui/dockwidget.h index 9cf233240..4fe9880b4 100644 --- a/src/blackgui/dockwidget.h +++ b/src/blackgui/dockwidget.h @@ -184,6 +184,7 @@ namespace BlackGui bool m_resetedFloating = false; bool m_selected = false; //!< selected when tabbed bool m_dockWidgetVisible = false; //!< logical visible, not to be confused with QDockWidget::isVisible() + bool m_wasFrameless = false; //!< frameless when last floating //! Empty widget with no size void initTitleBarWidgets(); @@ -191,6 +192,8 @@ namespace BlackGui //! Init status bar void initStatusBar(); + //! Force a style sheet update + void forceStyleSheetUpdate(); }; } // namespace diff --git a/src/blackgui/dockwidgetinfobar.cpp b/src/blackgui/dockwidgetinfobar.cpp index 447e72164..24ec58ab9 100644 --- a/src/blackgui/dockwidgetinfobar.cpp +++ b/src/blackgui/dockwidgetinfobar.cpp @@ -24,7 +24,7 @@ namespace BlackGui { this->setWindowTitle("Info status bar"); this->setWindowIcon(CIcons::swift24()); - this->ps_onStyleSheetsChanged(); + this->ps_onStyleSheetsChanged(); // margins from infobar } void CDockWidgetInfoBar::addToContextMenu(QMenu *contextMenu) const diff --git a/src/blackgui/enableforframelesswindow.cpp b/src/blackgui/enableforframelesswindow.cpp index b10d77692..1f3eec54a 100644 --- a/src/blackgui/enableforframelesswindow.cpp +++ b/src/blackgui/enableforframelesswindow.cpp @@ -111,6 +111,7 @@ namespace BlackGui { this->m_framelessSizeGrip->show(); } + statusBar->repaint(); } void CEnableForFramelessWindow::hideFramelessSizeGripInStatusBar() @@ -152,7 +153,6 @@ namespace BlackGui bool CEnableForFramelessWindow::isToolWindow() const { - return (this->m_widget->windowFlags() & Qt::Tool) == Qt::Tool; } @@ -168,7 +168,7 @@ namespace BlackGui return (Qt::Tool | Qt::WindowStaysOnTopHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); case WindowNormal: default: - return (Qt::Desktop | Qt::WindowStaysOnTopHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); + return (Qt::Window | Qt::WindowStaysOnTopHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint); } } diff --git a/src/blackgui/infoarea.cpp b/src/blackgui/infoarea.cpp index 0c8053715..96090f4e9 100644 --- a/src/blackgui/infoarea.cpp +++ b/src/blackgui/infoarea.cpp @@ -376,6 +376,10 @@ namespace BlackGui { dw->displayStatusMessage(statusMessage); } + for (CInfoArea *ia : this->getChildInfoAreas()) + { + ia->displayStatusMessage(statusMessage); + } } void CInfoArea::displayStatusMessages(const CStatusMessageList &statusMessages) @@ -384,6 +388,10 @@ namespace BlackGui { dw->displayStatusMessages(statusMessages); } + for (CInfoArea *ia : this->getChildInfoAreas()) + { + ia->displayStatusMessages(statusMessages); + } } void CInfoArea::ps_setDockArea(Qt::DockWidgetArea area) diff --git a/src/blackgui/managedstatusbar.cpp b/src/blackgui/managedstatusbar.cpp index 97afba137..41511cc1b 100644 --- a/src/blackgui/managedstatusbar.cpp +++ b/src/blackgui/managedstatusbar.cpp @@ -36,6 +36,7 @@ namespace BlackGui this->m_ownStatusBar = statusBar ? false : true; this->m_statusBar = statusBar ? statusBar : new QStatusBar(); if (this->m_statusBar->objectName().isEmpty()) { this->m_statusBar->setObjectName("sb_ManagedStatusBar"); } + if (this->m_ownStatusBar) { m_statusBar->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);} this->m_statusBarIcon = new QLabel(this->m_statusBar); this->m_statusBarLabel = new QLabel(this->m_statusBar); diff --git a/src/blackgui/qss/mainwindow.qss b/src/blackgui/qss/mainwindow.qss index f2d8aec22..38bd87e13 100644 --- a/src/blackgui/qss/mainwindow.qss +++ b/src/blackgui/qss/mainwindow.qss @@ -39,17 +39,18 @@ BlackGui--CDockWidgetInfoArea { background-color: green; /** I use green here so I can adjust the borders in gui.ini **/ } -/** this is the first widget in the dock area **/ -/** all dock widgets shall have this QWidget as container **/ BlackGui--CDockWidgetInfoArea > QWidget { - background-color: black; + background: black; /** background is background color here **/ background-image: url(:/textures/icons/textures/texture-inner.jpg); } -/** the following QFrame, likely the component itself -BlackGui--CDockWidgetInfoArea > QWidget > QFrame { - border: 0px; - padding: 0px; +/** this is the first widget in the dock area **/ +/** all dock widgets shall have this QWidget as container **/ +BlackGui--CDockWidgetInfoArea[framelessDockWidget="true"] > QWidget > QFrame { + margin: 0px; + padding: 3px; + border: 2px solid green; + border-radius: 10px; } /** fix the menu, which is overridden by the above QWidget **/ diff --git a/src/blackgui/qss/navigator.qss b/src/blackgui/qss/navigator.qss index c86497165..4b6974ca2 100644 --- a/src/blackgui/qss/navigator.qss +++ b/src/blackgui/qss/navigator.qss @@ -1,7 +1,8 @@ #fr_NavigatorDockWidgetInner[framelessDockWidget="true"] { margin: 0px; + padding: 3px; border: 2px solid green; - border-radius: 20px; + border-radius: 10px; } #fr_NavigatorDockWidgetInner QToolButton { diff --git a/src/swiftgui_standard/swiftguistd.cpp b/src/swiftgui_standard/swiftguistd.cpp index a9241a3de..e2394d008 100644 --- a/src/swiftgui_standard/swiftguistd.cpp +++ b/src/swiftgui_standard/swiftguistd.cpp @@ -238,7 +238,10 @@ void SwiftGuiStd::ps_displayStatusMessageInGui(const CStatusMessage &statusMessa if (statusMessage.wasHandledBy(this)) { return; } statusMessage.markAsHandledBy(this); this->m_statusBar.displayStatusMessage(statusMessage); + + // main info areas this->ui->comp_MainInfoArea->displayStatusMessage(statusMessage); + this->ui->comp_InvisibleInfoArea->displayStatusMessage(statusMessage); // list this->ui->comp_MainInfoArea->getLogComponent()->appendStatusMessageToList(statusMessage);