From e7874563e402030433e9b96b11b14bb38cdad3a8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 3 Mar 2014 16:43:58 +0100 Subject: [PATCH] Windows Vista Style: Don't draw menubar item background for QQ Controls In QtQuick Controls, we draw the full menubar background and the menubar items on top. Unless in a particular state, there's no need to draw the background or it may overlap with the menubar edge. Change-Id: Ia35a73274cc10b3b5a3f55573c92919f99555db0 Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qwindowsvistastyle.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 6c7b71bd741..f93e9312dee 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -1206,11 +1206,13 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget)) alignment |= Qt::TextHideMnemonic; - //The rect adjustment is a workaround for the menu not really filling its background. - XPThemeData theme(widget, painter, - QWindowsXPStylePrivate::MenuTheme, - MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 0, 2, 1)); - d->drawBackground(theme); + if (widget) { // Not needed for QtQuick Controls + //The rect adjustment is a workaround for the menu not really filling its background. + XPThemeData theme(widget, painter, + QWindowsXPStylePrivate::MenuTheme, + MENU_BARBACKGROUND, 0, option->rect.adjusted(-1, 0, 2, 1)); + d->drawBackground(theme); + } int stateId = MBI_NORMAL; if (disabled)