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 <jaroslaw.kobus@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2021-10-07 11:57:29 +02:00
parent 19b59f88d2
commit 0786e967dd

View File

@@ -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<const FancyMainWindow *>(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;