From c2c0e6af33b0498b2a47735f64b1da818dbb342f Mon Sep 17 00:00:00 2001 From: ann0see <20726856+ann0see@users.noreply.github.com> Date: Mon, 13 Feb 2023 12:15:51 +0100 Subject: [PATCH] Display server title correctly in dark mode --- src/clientdlg.cpp | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index 7b859bec52..7ae651e87e 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -1358,7 +1358,6 @@ void CClientDlg::SetGUIDesign ( const EGUIDesign eNewDesign ) " image: url(:/png/fader/res/ledbuttonpressed.png); }" "QCheckBox { color: rgb(220, 220, 220);" " font: bold; }" ); - #ifdef _WIN32 // Workaround QT-Windows problem: This should not be necessary since in the // background frame the style sheet for QRadioButton was already set. But it @@ -1450,31 +1449,39 @@ void CClientDlg::SetMixerBoardDeco ( const ERecorderState newRecorderState, cons eLastRecorderState = newRecorderState; eLastDesign = eNewDesign; + // set base style + QString sTitleStyle = "QGroupBox::title { subcontrol-origin: margin;" + " subcontrol-position: left top;" + " left: 7px;"; + if ( newRecorderState == RS_RECORDING ) { - MainMixerBoard->setStyleSheet ( "QGroupBox::title { subcontrol-origin: margin; " - " subcontrol-position: left top;" - " left: 7px;" - " color: rgb(255,255,255);" - " background-color: rgb(255,0,0); }" ); + sTitleStyle += "color: rgb(255,255,255);" + "background-color: rgb(255,0,0); }"; } else { if ( eNewDesign == GD_ORIGINAL ) { - MainMixerBoard->setStyleSheet ( "QGroupBox::title { subcontrol-origin: margin;" - " subcontrol-position: left top;" - " left: 7px;" - " color: rgb(220,220,220); }" ); + // no need to set the background color for dark mode in fancy skin, as the background is already dark. + sTitleStyle += "color: rgb(220,220,220); }"; } else { - MainMixerBoard->setStyleSheet ( "QGroupBox::title { subcontrol-origin: margin;" - " subcontrol-position: left top;" - " left: 7px;" - " color: rgb(0,0,0); }" ); + if ( palette().color ( QPalette::Window ) == QColor::fromRgbF ( 0.196078, 0.196078, 0.196078, 1 ) ) + { + // Dark mode on macOS/Linux needs a light color + + sTitleStyle += "color: rgb(220,220,220); }"; + } + else + { + sTitleStyle += "color: rgb(0,0,0); }"; + } } } + + MainMixerBoard->setStyleSheet ( sTitleStyle ); } void CClientDlg::SetPingTime ( const int iPingTime, const int iOverallDelayMs, const CMultiColorLED::ELightColor eOverallDelayLEDColor )