macOS: paint the menu-like empty area of an itemview

CE_MenuEmptyArea wasn't handled, as for menus PE_PanelMenu paints all
the pixels. However, QComboBox's internal QComboBoxListView type
respects that the QComboBox might use a popup menu for the drop down,
and paints the background using CE_MenuEmptyArea. If a custom delegate
is used, then that resulted in a base-colored background on an
otherwise window-colored drop-down.

Fix this by handling CE_MenuEmptyArea to delegate to PE_PanelMenu if
we are painting an itemview.

Change-Id: I5a8ba43e211564e92a3cfefa2778e615caa0f877
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Volker Hilsheimer 2024-10-24 17:21:03 +02:00 committed by Tor Arne Vestbø
parent 752b56dc3b
commit bfc76fa39c

View File

@ -4090,7 +4090,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
d->drawFocusRing(p, opt->rect, hMargin, vMargin, QMacStylePrivate::CocoaControl(ct, cs));
break; }
case CE_MenuEmptyArea:
// Skip: PE_PanelMenu fills in everything
// for QComboBoxListView
if (qobject_cast<const QAbstractItemView *>(w))
proxy()->drawPrimitive(PE_PanelMenu, opt, p, w);
// otherwise, PE_PanelMenu has already drawn everything
break;
case CE_MenuItem:
case CE_MenuHMargin: