From 133364e5972a1faa6cb8d5643e71c316bbeeaed7 Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Tue, 20 Apr 2021 19:07:55 -0300 Subject: [PATCH] Fix startup crash on Windows/Linux with HighDPI monitors The problem is setStyle being applied before button creation... This bug was introduced in c15d1bc, sorry. --- src/Gui/MainWindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 2fa702183..2fd062795 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -332,6 +332,16 @@ MainWindow::MainWindow(const QDir &home) styleSelector->setPalette(metal); connect(styleSelector, SIGNAL(segmentSelected(int)), this, SLOT(setStyleFromSegment(int))); //avoid toggle infinitely + // What's this button + whatsthis = new QPushButton(this); + whatsthis->setIcon(myHelper->icon()); + whatsthis->setFixedHeight(24 * dpiYFactor); + whatsthis->setIconSize(isize); + whatsthis->setStyle(toolStyle); + whatsthis->setToolTip(tr("What's This?")); + whatsthis->setPalette(metal); + connect(whatsthis, SIGNAL(clicked(bool)), this, SLOT(enterWhatsThisMode())); + #if defined(WIN32) || defined (Q_OS_LINUX) // are we in hidpi mode? if so undo global defaults for toolbar pushbuttons if (dpiXFactor > 1) { @@ -343,16 +353,6 @@ MainWindow::MainWindow(const QDir &home) } #endif - // What's this button - whatsthis = new QPushButton(this); - whatsthis->setIcon(myHelper->icon()); - whatsthis->setFixedHeight(24 * dpiYFactor); - whatsthis->setIconSize(isize); - whatsthis->setStyle(toolStyle); - whatsthis->setToolTip(tr("What's This?")); - whatsthis->setPalette(metal); - connect(whatsthis, SIGNAL(clicked(bool)), this, SLOT(enterWhatsThisMode())); - // add a search box on far right, but with a little space too searchBox = new SearchFilterBox(this,context,false);