summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAhmed Saidi <justroftest@gmail.com>2013-04-04 13:46:35 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-08 15:29:00 (GMT)
commit1e835a7419fac61da23d8e0c09c835a3a2aa0e45 (patch)
treebe5650ce7fd5e2fd430c5e49dd21cedab8abc44e /src
parent7e40da452773e104ce3fccb8d9f033ab2e01a8a4 (diff)
downloadQt-1e835a7419fac61da23d8e0c09c835a3a2aa0e45.zip
Qt-1e835a7419fac61da23d8e0c09c835a3a2aa0e45.tar.gz
Qt-1e835a7419fac61da23d8e0c09c835a3a2aa0e45.tar.bz2
QWizard/Win: Support RTL layout in Aero style
Task-number: QTBUG-30462 Change-Id: Ie6b3ba4975542a9d92611eb9a8547215e41d3c2c (cherry picked from qtbase/6f0dc9f4c7c1405bdbfef32395d0fb091bb0c8c8) Reviewed-by: Ahmed Saidi <justroftest@gmail.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/dialogs/qwizard.cpp10
-rw-r--r--src/gui/dialogs/qwizard_win.cpp18
2 files changed, 25 insertions, 3 deletions
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index a2f3c50..fbc7a79 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -3159,6 +3159,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/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index b933f3b..51cb9d5 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -231,7 +231,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
else if (underMouse())
state = WIZ_NAV_BB_HOT;
- pDrawThemeBackground(theme, p.paintEngine()->getDC(), WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect);
+ WIZ_NAVIGATIONPARTS buttonType = (layoutDirection() == Qt::LeftToRight
+ ? WIZ_NAV_BACKBUTTON
+ : WIZ_NAV_FORWARDBUTTON);
+
+ pDrawThemeBackground(theme, p.paintEngine()->getDC(), buttonType, state, &clipRect, &clipRect);
}
/******************************************************************************
@@ -348,13 +352,21 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
glowOffset = glowSize();
}
+ const int titleLeft = (wizard->layoutDirection() == Qt::LeftToRight
+ ? titleOffset() - glowOffset
+ : wizard->width() - titleOffset() - textWidth + glowOffset);
+
drawTitleText(
painter, text,
- QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
+ QRect(titleLeft, verticalCenter - textHeight / 2, textWidth, textHeight),
hdc);
if (!wizard->windowIcon().isNull()) {
- QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
+ const int iconLeft = (wizard->layoutDirection() == Qt::LeftToRight
+ ? leftMargin()
+ : wizard->width() - leftMargin() - iconSize());
+
+ QRect rect(iconLeft, verticalCenter - iconSize() / 2, iconSize(), iconSize());
HICON hIcon = wizard->windowIcon().pixmap(iconSize()).toWinHICON();
DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);