comparison view/ViewManager.cpp @ 1574:dd7166cdf6bc background-mode

Windows stylesheet
author Chris Cannam
date Fri, 17 Jan 2020 21:36:54 +0000
parents 4e466690bf20
children 3761d1ea5015
comparison
equal deleted inserted replaced
1573:4e466690bf20 1574:dd7166cdf6bc
779 m_darkPalette = QApplication::palette(); 779 m_darkPalette = QApplication::palette();
780 } else { 780 } else {
781 m_lightPalette = QApplication::palette(); 781 m_lightPalette = QApplication::palette();
782 } 782 }
783 783
784 #ifndef Q_OS_MAC 784 #ifdef Q_OS_MAC
785 return;
786 #endif
787
785 if (dark) { 788 if (dark) {
789
790 #ifdef Q_OS_WIN32
791 // Some UI elements on Windows don't use the palette.
792
793 QString existingStyleSheet = qApp->styleSheet();
794 if (existingStyleSheet == "") {
795 QString styleSheet =
796 "QFrame { background: #202020; color: #f0f0f0; }\n"
797 "QAbstractButton { background: #202020; color: #f0f0f0; }\n"
798 "QDialog { background-color: #202020; }\n"
799 "QToolBar { background-color: #202020; }\n"
800 "QMenuBar { background-color: #404040; }\n"
801 "QMenuBar::item:selected { background-color: #707070; }\n"
802 "QMenuBar::item:pressed { background-color: #707070; }\n"
803 "QComboBox { background-color: #404040; }\n"
804 "QTabWidget::pane { border: 1px solid #c7c7c7; top: -1px; }\n"
805 "QTabBar::tab { background-color: #404040; border: 1px solid #c7c7c7; bottom: -1px; padding: 5px; }\n"
806 "QTabBar::tab:selected { background-color: #707070; }\n"
807 ;
808 qApp->setStyleSheet(styleSheet);
809 }
810 #endif
811
786 QApplication::setPalette(m_darkPalette); 812 QApplication::setPalette(m_darkPalette);
787 } else { 813
814 } else {
815
816 #ifdef Q_OS_WIN32
817 qApp->setStyleSheet("");
818 #endif
819
788 QApplication::setPalette(m_lightPalette); 820 QApplication::setPalette(m_lightPalette);
789 } 821 }
790 #endif
791 } 822 }
792 823
793 bool 824 bool
794 ViewManager::getGlobalDarkBackground() const 825 ViewManager::getGlobalDarkBackground() const
795 { 826 {