From c78d7f84cd1ecf2130de16b2b06acf390fad5d06 Mon Sep 17 00:00:00 2001 From: Arttu Tarkiainen Date: Tue, 9 Mar 2021 10:56:03 +0200 Subject: Fix styling of QMessageBoxes MessageBoxHandler will decide an appropriate parent widget for new QMessageBox objects just before they are shown. This is not quaranteed to be a PackageManagerGui instance, for example when the installer wizard does not have focus, which means the style properties do not get inherited. Rather set the used style sheet for the whole application using QApplication::setStyleSheet(). Task-number: QTIFW-2121 Change-Id: I6f2131279d6f6d3dd41b9eacab8404770aad09a3 Reviewed-by: Katja Marttila --- src/libs/installer/packagemanagergui.cpp | 2 +- src/sdk/tabcontroller.cpp | 19 +------------------ 2 files changed, 2 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 86c3a2d0c..d52034389 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -321,7 +321,7 @@ PackageManagerGui::PackageManagerGui(PackageManagerCore *core, QWidget *parent) QFile sheet(styleSheetFile); if (sheet.exists()) { if (sheet.open(QIODevice::ReadOnly)) { - setStyleSheet(QString::fromLatin1(sheet.readAll())); + qApp->setStyleSheet(QString::fromLatin1(sheet.readAll())); } else { qCWarning(QInstaller::lcDeveloperBuild) << "The specified style sheet file " "can not be opened."; diff --git a/src/sdk/tabcontroller.cpp b/src/sdk/tabcontroller.cpp index 5e2f1ed13..3bcb3f11a 100644 --- a/src/sdk/tabcontroller.cpp +++ b/src/sdk/tabcontroller.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -166,23 +166,6 @@ void TabController::restartWizard() void TabController::onSettingsButtonClicked() { SettingsDialog dialog(d->m_core); - // set custom stylesheet - const QString styleSheetFile = d->m_core->settings().styleSheet(); - if (!styleSheetFile.isEmpty()) { - QFile sheet(styleSheetFile); - if (sheet.exists()) { - if (sheet.open(QIODevice::ReadOnly)) { - dialog.setStyleSheet(QString::fromLatin1(sheet.readAll())); - } else { - qCWarning(QInstaller::lcDeveloperBuild) << "The specified style sheet file " - "can not be opened."; - } - } else { - qCWarning(QInstaller::lcDeveloperBuild) << "A style sheet file is specified, " - "but it does not exist."; - } - } - connect(&dialog, &SettingsDialog::networkSettingsChanged, this, &TabController::onNetworkSettingsChanged); dialog.exec(); -- cgit v1.2.3