summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstylesheetstyle.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-12-10 13:51:40 +0200
committerLiang Qi <liang.qi@qt.io>2019-12-10 13:51:40 +0200
commit90210d5d9c4029057035019f144212922494ff0a (patch)
tree1aacefa57786964d47a200791280ae91c9b825da /src/widgets/styles/qstylesheetstyle.cpp
parentc69a2448ab129d88411a4778f2350dcf971dc623 (diff)
parent5231c26a82a7056f98d99643850754d4e1ebe417 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: tests/auto/network/kernel/qnetworkinterface/BLACKLIST Change-Id: I1e8866c63b54bcd95fc2a044276ee15b7f60e79a
Diffstat (limited to 'src/widgets/styles/qstylesheetstyle.cpp')
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index c40bbbc96c..7e8c9a6050 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3501,6 +3501,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
} else {
QWindowsStyle::drawControl(ce, &btnOpt, p, w);
}
+ rule.drawImage(p, rule.contentsRect(opt->rect));
if (!customMenu)
return;
} else {
@@ -3730,6 +3731,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
bool dis = !(opt->state & QStyle::State_Enabled),
act = opt->state & QStyle::State_Selected;
+ int textRectOffset = m->maxIconWidth;
if (!mi.icon.isNull()) {
QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
if (act && !dis)
@@ -3755,19 +3757,21 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
p->drawPixmap(pmr.topLeft(), pixmap);
} else if (checkable) {
QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark);
+ const QRect cmRect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction);
if (subSubRule.hasDrawable() || checked) {
QStyleOptionMenuItem newMi = mi;
if (!dis)
newMi.state |= State_Enabled;
- if (act)
+ if (mi.checked)
newMi.state |= State_On;
- newMi.rect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction);
+ newMi.rect = cmRect;
drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w);
}
+ textRectOffset = std::max(textRectOffset, cmRect.width());
}
QRect textRect = subRule.contentsRect(opt->rect);
- textRect.setLeft(textRect.left() + m->maxIconWidth);
+ textRect.setLeft(textRect.left() + textRectOffset);
textRect.setWidth(textRect.width() - mi.tabWidth);
const QRect vTextRect = visualRect(opt->direction, m->rect, textRect);