diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2014-01-22 09:13:17 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 15:44:15 (GMT) |
commit | 05651ca4be506eaf9714a3f37c629a58c5c5856d (patch) | |
tree | 2e8cbf976aa9231242f5401ba02d585b4483e9c1 /src | |
parent | 46613b276364a78b803a7eb4d8e96bced5c20155 (diff) | |
download | Qt-05651ca4be506eaf9714a3f37c629a58c5c5856d.zip Qt-05651ca4be506eaf9714a3f37c629a58c5c5856d.tar.gz Qt-05651ca4be506eaf9714a3f37c629a58c5c5856d.tar.bz2 |
QWindowsVistaStyle: Fixed position of menu gutter when using a custom widget action.
The gutter position was hardcoded to 28 which fits when drawing
on the QMenu with a left margin of 3. It became offset when drawing
on a custom widget with no margin. Calculate position relative
to margin for left to right.
[ChangeLog][QtWidgets][QMenu][Windows] Fixed position of menu gutter when using a custom widget action.
Task-number: QTBUG-36218
Change-Id: Ibb34a9fba2bab7257482b80d2e51e76a9755345c
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
(cherry picked from qtbase/a5c288ea5675a382edf0b3ecae42f461a22a7303)
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qwindowsvistastyle.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp index 1682822..c14dfb5 100644 --- a/src/gui/styles/qwindowsvistastyle.cpp +++ b/src/gui/styles/qwindowsvistastyle.cpp @@ -1246,18 +1246,20 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption case CE_MenuItem: if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { // windows always has a check column, regardless whether we have an icon or not - int checkcol = 28; + int checkcol = 25; { SIZE size; MARGINS margins; XPThemeData theme(widget, 0, QLatin1String("MENU"), MENU_POPUPCHECKBACKGROUND, MBI_HOT); pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size); pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins); - checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth)); + checkcol = qMax(menuitem->maxIconWidth, int(3 + size.cx + margins.cxLeftWidth + margins.cxRightWidth)); } QRect rect = option->rect; //draw vertical menu line + if (option->direction == Qt::LeftToRight) + checkcol += rect.x(); QPoint p1 = QStyle::visualPos(option->direction, menuitem->rect, QPoint(checkcol, rect.top())); QPoint p2 = QStyle::visualPos(option->direction, menuitem->rect, QPoint(checkcol, rect.bottom())); QRect gutterRect(p1.x(), p1.y(), 3, p2.y() - p1.y() + 1); |