From 0786e967ddb52a2c744576ae9dbc7ec4844b9581 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Thu, 7 Oct 2021 11:57:29 +0200 Subject: Core: Prevent contents of Popups being styled as "panelwidgets" Content of widgets with windowType Qt::Dialog was already excluded from being styled as "panelwidgets". This change adds Qt::Popup to the blacklist. Task-number: QTCREATORBUG-26370 Change-Id: I76d07da4d8f3ae9f1c8235cdc072a04917454065 Reviewed-by: Jarek Kobus Reviewed-by: Eike Ziller --- src/plugins/coreplugin/manhattanstyle.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 9a8934b989..50837d9f15 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -73,14 +73,20 @@ bool styleEnabled(const QWidget *widget) return true; } +static bool isInDialogOrPopup(const QWidget *widget) +{ + // Do not style dialogs or explicitly ignored widgets + const Qt::WindowType windowType = widget->window()->windowType(); + return (windowType == Qt::Dialog || windowType == Qt::Popup); +} + // Consider making this a QStyle state bool panelWidget(const QWidget *widget) { if (!widget) return false; - // Do not style dialogs or explicitly ignored widgets - if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog) + if (isInDialogOrPopup(widget)) return false; if (qobject_cast(widget)) @@ -107,8 +113,7 @@ bool lightColored(const QWidget *widget) if (!widget) return false; - // Don't style dialogs or explicitly ignored widgets - if ((widget->window()->windowFlags() & Qt::WindowType_Mask) == Qt::Dialog) + if (isInDialogOrPopup(widget)) return false; const QWidget *p = widget; -- cgit v1.2.3