diff options
author | Ahmed Saidi <justroftest@gmail.com> | 2013-04-04 12:27:24 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-08 11:35:44 +0200 |
commit | 6f0dc9f4c7c1405bdbfef32395d0fb091bb0c8c8 (patch) | |
tree | 66fce9e6b7fa82866466c9283c3c51bd2ddf6d1c /src/widgets | |
parent | 47a9f80dc17626df65296648bc2e756062bd0b0c (diff) |
QWizard/Win: Support RTL layout in Aero style
Task-number: QTBUG-30462
Change-Id: Ie6b3ba4975542a9d92611eb9a8547215e41d3c2c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Ahmed Saidi <justroftest@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qwizard.cpp | 10 | ||||
-rw-r--r-- | src/widgets/dialogs/qwizard_win.cpp | 18 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp index 72283451d7..b7a91a3d4b 100644 --- a/src/widgets/dialogs/qwizard.cpp +++ b/src/widgets/dialogs/qwizard.cpp @@ -3131,6 +3131,16 @@ bool QWizard::event(QEvent *event) d->handleAeroStyleChange(); } else if (d->isVistaThemeEnabled()) { + if (event->type() == QEvent::Resize + || event->type() == QEvent::LayoutDirectionChange) { + const int buttonLeft = (layoutDirection() == Qt::RightToLeft + ? width() - d->vistaHelper->backButton()->sizeHint().width() + : 0); + + d->vistaHelper->backButton()->move(buttonLeft, + d->vistaHelper->backButton()->y()); + } + d->vistaHelper->mouseEvent(event); } #endif diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp index 001c21da61..b57614c018 100644 --- a/src/widgets/dialogs/qwizard_win.cpp +++ b/src/widgets/dialogs/qwizard_win.cpp @@ -240,7 +240,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *) else if (underMouse()) state = WIZ_NAV_BB_HOT; - pDrawThemeBackground(theme, hdc, WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect); + WIZ_NAVIGATIONPARTS buttonType = (layoutDirection() == Qt::LeftToRight + ? WIZ_NAV_BACKBUTTON + : WIZ_NAV_FORWARDBUTTON); + + pDrawThemeBackground(theme, hdc, buttonType, state, &clipRect, &clipRect); } /****************************************************************************** @@ -385,7 +389,11 @@ void QVistaHelper::drawTitleBar(QPainter *painter) glowOffset = glowSize(); } - const QRect textRectangle(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight); + const int titleLeft = (wizard->layoutDirection() == Qt::LeftToRight + ? titleOffset() - glowOffset + : wizard->width() - titleOffset() - textWidth + glowOffset); + + const QRect textRectangle(titleLeft, verticalCenter - textHeight / 2, textWidth, textHeight); if (isWindow) { drawTitleText(painter, text, textRectangle, hdc); } else { @@ -397,7 +405,11 @@ void QVistaHelper::drawTitleBar(QPainter *painter) const QIcon windowIcon = wizard->windowIcon(); if (!windowIcon.isNull()) { - const QRect rect(origin.x() + leftMargin(), + const int iconLeft = (wizard->layoutDirection() == Qt::LeftToRight + ? leftMargin() + : wizard->width() - leftMargin() - iconSize()); + + const QRect rect(origin.x() + iconLeft, origin.y() + verticalCenter - iconSize() / 2, iconSize(), iconSize()); const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(iconSize())); DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT); |