diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e7e816bc..1ceb3808c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1087,7 +1087,10 @@ qt5_wrap_ui (wsjt_qt_GENUISRCS ${wsjt_qt_UISRCS}) qt5_wrap_ui (wsjtx_GENUISRCS ${wsjtx_UISRCS}) # Resource generation -qt5_add_resources (wsjtx_RESOURCES_RCC ${CMAKE_BINARY_DIR}/wsjtx.qrc) +qt5_add_resources (wsjtx_RESOURCES_RCC + ${CMAKE_BINARY_DIR}/wsjtx.qrc + contrib/QDarkStyleSheet/qdarkstyle/style.qrc + ) # AX COM servers if (WIN32) @@ -1324,7 +1327,10 @@ target_link_libraries (udp_daemon wsjtx_udp-static) add_resources (message_aggregator_RESOURCES /qss ${message_aggregator_STYLESHEETS}) configure_file (UDPExamples/message_aggregator.qrc.in message_aggregator.qrc @ONLY) -qt5_add_resources (message_aggregator_RESOURCES_RCC ${CMAKE_CURRENT_BINARY_DIR}/message_aggregator.qrc) +qt5_add_resources (message_aggregator_RESOURCES_RCC + ${CMAKE_CURRENT_BINARY_DIR}/message_aggregator.qrc + contrib/QDarkStyleSheet/qdarkstyle/style.qrc + ) add_executable (message_aggregator ${message_aggregator_CXXSRCS} ${WSJTX_ICON_FILE} diff --git a/UDPExamples/MessageAggregator.cpp b/UDPExamples/MessageAggregator.cpp index 81515ac04..52124045e 100644 --- a/UDPExamples/MessageAggregator.cpp +++ b/UDPExamples/MessageAggregator.cpp @@ -63,14 +63,29 @@ int main (int argc, char * argv[]) QObject::connect (&app, SIGNAL (lastWindowClosed ()), &app, SLOT (quit ())); { - QFile file {":/qss/default.qss"}; - if (!file.open (QFile::ReadOnly)) + QString ss; + auto sf = qApp->styleSheet (); + if (sf.size ()) { - throw std::runtime_error { - QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()} - .toLocal8Bit ().constData ()}; + sf.remove ("file:///"); + QFile file {sf}; + if (!file.open (QFile::ReadOnly)) + { + throw std::runtime_error { + QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()}.toStdString ()}; + } + ss += file.readAll (); } - app.setStyleSheet (file.readAll()); + { + QFile file {":/qss/default.qss"}; + if (!file.open (QFile::ReadOnly)) + { + throw std::runtime_error { + QString {"failed to open \"" + file.fileName () + "\": " + file.errorString ()}.toStdString ()}; + } + ss += file.readAll (); + } + app.setStyleSheet (ss); } MessageAggregatorMainWindow window; diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 42dac2f5a..4f7f4dc8b 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -1236,7 +1236,18 @@ void MainWindow::set_application_font (QFont const& font) qApp->setFont (font); // set font in the application style sheet as well in case it has // been modified in the style sheet which has priority - qApp->setStyleSheet (qApp->styleSheet () + "* {" + font_as_stylesheet (font) + '}'); + QString ss; + if (qApp->styleSheet ().size ()) + { + auto sheet = qApp->styleSheet (); + sheet.remove ("file:///"); + QFile sf {sheet}; + if (sf.open (QFile::ReadOnly | QFile::Text)) + { + ss = sf.readAll () + ss; + } + } + qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}'); for (auto& widget : qApp->topLevelWidgets ()) { widget->updateGeometry ();