[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [osx-integration/qt590-r2l] src/qmacstyle: R2L menus seems quite acceptable this way
From: R.J.V. Bertin <null () kde ! org>
Date: 2017-06-30 22:04:30
Message-ID: E1dR41e-0006mL-A3 () code ! kde ! org
[Download RAW message or body]
Git commit 50ad549ab3cc34f1c1f963d98d0f027d5c7197a0 by R.J.V. Bertin.
Committed on 30/06/2017 at 22:03.
Pushed by rjvbb into branch 'qt590-r2l'.
R2L menus seems quite acceptable this way
Committed from host : Portia.local
M +15 -8 src/qmacstyle/qmacstyle_mac.mm
https://commits.kde.org/osx-integration/50ad549ab3cc34f1c1f963d98d0f027d5c7197a0
diff --git a/src/qmacstyle/qmacstyle_mac.mm b/src/qmacstyle/qmacstyle_mac.mm
index 95ad17c..3a40d8a 100644
--- a/src/qmacstyle/qmacstyle_mac.mm
+++ b/src/qmacstyle/qmacstyle_mac.mm
@@ -4496,8 +4496,11 @@ void QMacStyle::drawControl(ControlElement ce, const \
QStyleOption *opt, QPainter contentRect = qt_qrectForHIRect(cr);
}
int xpos = leftToRight? contentRect.x() + 18 :
- contentRect.x() - 18 + macItemFrame;
+ contentRect.right() - 6;
int checkcol = maxpmw;
+ QStyleOption checkmarkOpt;
+ checkmarkOpt.initFrom(w);
+ int checkmarkWidth = checkmarkOpt.fontMetrics.width(QChar(0x2713));
if (!enabled)
p->setPen(mi->palette.text().color());
else if (active)
@@ -4507,13 +4510,11 @@ void QMacStyle::drawControl(ControlElement ce, const \
QStyleOption *opt, QPainter
if (mi->menuItemType != QStyleOptionMenuItem::Separator) {
if (mi->checked) {
- QStyleOption checkmarkOpt;
- checkmarkOpt.initFrom(w);
const int mw = checkcol + macItemFrame;
const int mh = contentRect.height() + macItemFrame;
const int xp = leftToRight ? contentRect.x() + macItemFrame :
- contentRect.right() - macItemFrame - \
checkmarkOpt.fontMetrics.width(QChar(0x2713)); + \
contentRect.right() - macItemFrame - checkmarkWidth;
checkmarkOpt.rect = QRect(xp, contentRect.y() - \
checkmarkOpt.fontMetrics.descent(), mw, mh);
checkmarkOpt.state |= State_On; // Always on. Never rendered \
when off. @@ -4544,14 +4545,15 @@ void QMacStyle::drawControl(ControlElement ce, \
const QStyleOption *opt, QPainter
QPixmap pixmap = mi->icon.pixmap(window, iconSize, mode);
int pixw = pixmap.width() / pixmap.devicePixelRatio();
int pixh = pixmap.height() / pixmap.devicePixelRatio();
- int xp = leftToRight? xpos : contentRect.right() - 18 - pixw;
+ int xp = leftToRight? xpos : xpos - pixw - macItemFrame - \
checkmarkWidth;
QRect cr(xp, contentRect.y(), checkcol, contentRect.height());
QRect pmr(0, 0, pixw, pixh);
pmr.moveCenter(cr.center());
p->drawPixmap(pmr.topLeft(), pixmap);
- // FIXME: position adjustment for R2L
if (leftToRight) {
xpos += pixw + 6;
+ } else {
+ xpos -= pixw + 6;
}
}
}
@@ -4617,8 +4619,13 @@ void QMacStyle::drawControl(ControlElement ce, const \
QStyleOption *opt, QPainter }
} else {
p->setFont(myFont);
- p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1,
- contentRect.height(), text_flags | (leftToRight ? \
Qt::AlignLeft : Qt::AlignRight), s); + if (leftToRight) {
+ p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth \
+ 1, + contentRect.height(), text_flags | \
Qt::AlignLeft, s); + } else {
+ p->drawText(xpos - p->fontMetrics().width(s), yPos, \
contentRect.width() - xm - tabwidth + 1, + \
contentRect.height(), text_flags | Qt::AlignLeft, s); + }
}
p->restore();
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic