summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-09 10:56:03 +0200
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2021-03-10 06:57:00 +0000
commitc78d7f84cd1ecf2130de16b2b06acf390fad5d06 (patch)
treee976e7a1b4bedb35b6eb37e4a9f3e709666e8396
parent6fdadf83710c37f70c1d2d621eacb9cbb327b23b (diff)
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 <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/packagemanagergui.cpp2
-rw-r--r--src/sdk/tabcontroller.cpp19
2 files changed, 2 insertions, 19 deletions
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();