From bfc76fa39c2bab67ef1857407be539b1f88919e5 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 24 Oct 2024 17:21:03 +0200 Subject: [PATCH] macOS: paint the menu-like empty area of an itemview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ø --- src/plugins/styles/mac/qmacstyle_mac.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 353fd68adfa..7d2d4560703 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -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(w)) + proxy()->drawPrimitive(PE_PanelMenu, opt, p, w); + // otherwise, PE_PanelMenu has already drawn everything break; case CE_MenuItem: case CE_MenuHMargin: