After trying the links above and a bit of Googling, the solution I ended up using was using QPalettes. This is very similar to the palettes used by Jorken-VikingGod in the link above. The advantage of this over the style sheets is that it it seemed to affect the layout of controls less since it uses the same controls. In case this is useful for anyone else, this code only uses the dark theme if compiling for Windows and the user is using the dark theme. If the user changes the theme while the program is running it does not change back to light, but this is still suitable for my needs. I just added the following to the main() function before showing the main window.

#ifdef Q_OS_WIN QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",QSettings::NativeFormat); if(settings.value("AppsUseLightTheme")==0){ qApp->setStyle(QStyleFactory::create("Fusion")); QPalette darkPalette; QColor darkColor = QColor(45,45,45); QColor disabledColor = QColor(127,127,127); darkPalette.setColor(QPalette::Window, darkColor); darkPalette.setColor(QPalette::WindowText, Qt::white); darkPalette.setColor(QPalette::Base, QColor(18,18,18)); darkPalette.setColor(QPalette::AlternateBase, darkColor); darkPalette.setColor(QPalette::ToolTipBase, Qt::white); darkPalette.setColor(QPalette::ToolTipText, Qt::white); darkPalette.setColor(QPalette::Text, Qt::white); darkPalette.setColor(QPalette::Disabled, QPalette::Text, disabledColor); darkPalette.setColor(QPalette::Button, darkColor); darkPalette.setColor(QPalette::ButtonText, Qt::white); darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, disabledColor); darkPalette.setColor(QPalette::BrightText, Qt::red); darkPalette.setColor(QPalette::Link, QColor(42, 130, 218)); darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218)); darkPalette.setColor(QPalette::HighlightedText, Qt::black); darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, disabledColor); qApp->setPalette(darkPalette); qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"); } #endif

I also had to add #include <QStyleFactory> to main.cpp