Skip to content

Commit c15e918

Browse files
committed
Set standard base Qt style on Windows and macOS
This sets the "Fusion" Qt theme as the application's base style for Windows and macOS to normalize some minor appearance issues between different platforms. Fusion is the default style used for Linux for desktops without a custom window manager theme. From what I read, the Windows theme still has some high-DPI issues, and the Fusion styles support high-DPI displays very well.
1 parent c33982a commit c15e918

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/qt/bitcoin.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ int main(int argc, char *argv[])
241241

242242
// Generate high-dpi pixmaps
243243
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
244-
#if QT_VERSION >= 0x050600 && !defined(WIN32)
244+
#if QT_VERSION >= 0x050600
245245
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
246246
#endif
247247

@@ -264,6 +264,20 @@ int main(int argc, char *argv[])
264264
else
265265
app.setApplicationName("Gridcoin-Qt");
266266

267+
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
268+
// Apply Qt's built-in "Fusion" theme as the application's base styles to
269+
// normalize layout discrepancies between platforms and fix some high-DPI
270+
// scaling issues on Windows. Gridcoin uses highly-customized stylesheets
271+
// which obscure most of the platform's styles anyway. That said, respect
272+
// the presence of Qt's "-style" option to bypass this if necessary. Skip
273+
// the override on Linux for now so that a user's window manager Qt theme
274+
// comes through for widgets without an explicit application style.
275+
//
276+
if (!IsArgSet("-style")) {
277+
app.setStyle("Fusion");
278+
}
279+
#endif
280+
267281
// Install global event filter that makes sure that long tooltips can be word-wrapped
268282
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
269283

0 commit comments

Comments
 (0)