From c099f622bb50b6b42ddca030ba4062dee7cf8752 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Tue, 12 Oct 2021 00:28:19 +0200 Subject: [PATCH] Core: Allow dialogs and popups be styled as "panelwidgets" A recent change that prevented popups from being styled as "panelwidget" unintentionally removed the styling from the upper part of the mini target chooser. This change re-allows styling contents of popups (and dialogs) if they have the "panelwidget" property set to true. Amends: 0786e967ddb52a2c744576ae9dbc7ec4844b9581 Fixes: QTCREATORBUG-26403 Change-Id: Ib85b06d0a2823a5caf736d1354cf025a6ddd475c Reviewed-by: Christian Stenger --- src/plugins/coreplugin/manhattanstyle.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 50837d9f153..a6b94660f6f 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -73,10 +73,13 @@ bool styleEnabled(const QWidget *widget) return true; } -static bool isInDialogOrPopup(const QWidget *widget) +static bool isInUnstyledDialogOrPopup(const QWidget *widget) { - // Do not style dialogs or explicitly ignored widgets - const Qt::WindowType windowType = widget->window()->windowType(); + // Do not style contents of dialogs or popups without "panelwidget" property + const QWidget *window = widget->window(); + if (window->property("panelwidget").toBool()) + return false; + const Qt::WindowType windowType = window->windowType(); return (windowType == Qt::Dialog || windowType == Qt::Popup); } @@ -86,7 +89,7 @@ bool panelWidget(const QWidget *widget) if (!widget) return false; - if (isInDialogOrPopup(widget)) + if (isInUnstyledDialogOrPopup(widget)) return false; if (qobject_cast(widget)) @@ -113,7 +116,7 @@ bool lightColored(const QWidget *widget) if (!widget) return false; - if (isInDialogOrPopup(widget)) + if (isInUnstyledDialogOrPopup(widget)) return false; const QWidget *p = widget;