summaryrefslogtreecommitdiffstats
path: root/src/gui/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/styles/qcommonstyle.cpp')
-rw-r--r--src/gui/styles/qcommonstyle.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index d4488ec92..2dab9b3cd 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -564,7 +564,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
p->translate(opt->rect.x(), opt->rect.y());
if (opt->state & State_Horizontal) {
int x = opt->rect.width() / 3;
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (opt->direction == Qt::RightToLeft)
x -= 2;
if (opt->rect.height() > 4) {
qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,
@@ -5224,6 +5224,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
Q_UNUSED(sp);
#else
QPixmap pixmap;
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft();
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (sp) {
@@ -5382,7 +5383,7 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
switch (sp) {
#ifndef QT_NO_IMAGEFORMAT_XPM
case SP_ToolBarHorizontalExtensionButton:
- if (QApplication::layoutDirection() == Qt::RightToLeft) {
+ if (rtl) {
QImage im(tb_extension_arrow_h_xpm);
im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false);
return QPixmap::fromImage(im);
@@ -5398,11 +5399,11 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti
#ifndef QT_NO_IMAGEFORMAT_PNG
case SP_CommandLink:
case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
return proxy()->standardPixmap(SP_ArrowRight, option, widget);
case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return proxy()->standardPixmap(SP_ArrowRight, option, widget);
return proxy()->standardPixmap(SP_ArrowLeft, option, widget);
case SP_ArrowLeft:
@@ -5513,6 +5514,7 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
const QWidget *widget) const
{
QIcon icon;
+ const bool rtl = (option && option->direction == Qt::RightToLeft) || !option && QApplication::isRightToLeft();
if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
switch (standardIcon) {
case SP_DirHomeIcon:
@@ -5637,11 +5639,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
icon = QIcon::fromTheme(QLatin1String("edit-clear"));
break;
case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowLeft, option, widget);
return standardIconImplementation(SP_ArrowRight, option, widget);
case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowRight, option, widget);
return standardIconImplementation(SP_ArrowLeft, option, widget);
case SP_FileLinkIcon:
@@ -5865,11 +5867,11 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons
icon.addFile(QLatin1String(":/trolltech/styles/commonstyle/images/standardbutton-no-128.png"));
break;
case SP_ArrowForward:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowLeft, option, widget);
return standardIconImplementation(SP_ArrowRight, option, widget);
case SP_ArrowBack:
- if (QApplication::layoutDirection() == Qt::RightToLeft)
+ if (rtl)
return standardIconImplementation(SP_ArrowRight, option, widget);
return standardIconImplementation(SP_ArrowLeft, option, widget);
case SP_ArrowLeft: