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: 0786e967dd

Fixes: QTCREATORBUG-26403
Change-Id: Ib85b06d0a2823a5caf736d1354cf025a6ddd475c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2021-10-12 00:28:19 +02:00
parent 0543a810e5
commit c099f622bb

View File

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