This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The button clicked events can be replaced with any slots, and/or you can define the | |
// switchPalette() to be a slot to use with QObject::connect() | |
// Dark Palette push button | |
void MainWindow::on_switchToDarkTheme_clicked() | |
{ | |
this->switchPalette(darkPalette); | |
} | |
// Light palette push button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qApp->setStyle(QStyleFactory::create("Fusion")); | |
QPalette darkPalette; | |
darkPalette.setColor(QPalette::Window, QColor(53,53,53)); | |
darkPalette.setColor(QPalette::WindowText, Qt::white); | |
darkPalette.setColor(QPalette::Base, QColor(25,25,25)); | |
darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53)); | |
darkPalette.setColor(QPalette::ToolTipBase, Qt::white); | |
darkPalette.setColor(QPalette::ToolTipText, Qt::white); | |
darkPalette.setColor(QPalette::Text, Qt::white); |