aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-09 11:16:03 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-10-12 14:50:13 +0200
commit88daafb4167f4d095c8e2559eea3bc67259c1900 (patch)
tree0a392fb3e83a91cd50908c84a495a0f8b95fe598 /src/imports
parentd956d1062479d0af914c96ac615d2aa2a35be4cd (diff)
Native style, macOS: always draw a TextField using NSTextField
There is no apparent reason as to why we should let QCommonStyle fill the background before it calls PE_FrameLineEdit in QMacStyle. The NSTextField cell already draws the correct background, which is supposede to be semi-transparent in dark-mode. Therefore, just let PE_PanelLineEdit and PE_FrameLineEdit be drawn the same way. Change-Id: Iacd4f1b1802e1b0c2b96a92cf271b681c10b8cff Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm31
1 files changed, 1 insertions, 30 deletions
diff --git a/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm b/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
index 9575f888..e857ff96 100644
--- a/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
+++ b/src/imports/nativestyle/qstyle/mac/qquickmacstyle_mac.mm
@@ -2971,6 +2971,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->drawRect(opt->rect);
p->setPen(oldPen);
break; }
+ case PE_PanelLineEdit:
case PE_FrameLineEdit:
if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
if (frame->state & State_Sunken) {
@@ -3017,36 +3018,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
}
}
break;
- case PE_PanelLineEdit:
- {
- const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt);
- if (qt_mac_applicationIsInDarkMode() || (panel && panel->lineWidth <= 0)) {
- // QCommonStyle::drawPrimitive(PE_PanelLineEdit) fill the background with
- // a proper color, defined in opt->palette and then, if lineWidth > 0, it
- // calls QMacStyle::drawPrimitive(PE_FrameLineEdit). We use NSTextFieldCell
- // to handle PE_FrameLineEdit, which will use system-default background.
- // In 'Dark' mode it's transparent and thus it's not over-painted.
- QCommonStyle::drawPrimitive(pe, opt, p);
- } else {
- // In 'Light' mode, if panel->lineWidth > 0, we have to use the correct
- // background color when drawing PE_FrameLineEdit, so let's call it
- // directly and set the proper color there.
- drawPrimitive(PE_FrameLineEdit, opt, p);
- }
-
- // Draw the focus frame for widgets other than QLineEdit (e.g. for line edits in Webkit).
- // Focus frame is drawn outside the rectangle passed in the option-rect.
- if (panel) {
-// if ((opt->state & State_HasFocus) && !qobject_cast<const QLineEdit*>(w)) {
-// int vmargin = pixelMetric(QStyle::PM_FocusFrameVMargin);
-// int hmargin = pixelMetric(QStyle::PM_FocusFrameHMargin);
-// QStyleOptionFrame focusFrame = *panel;
-// focusFrame.rect = panel->rect.adjusted(-hmargin, -vmargin, hmargin, vmargin);
-// drawControl(CE_FocusFrame, &focusFrame, p);
-// }
- }
- }
- break;
case PE_PanelScrollAreaCorner: {
const QBrush brush(opt->palette.brush(QPalette::Base));
p->fillRect(opt->rect, brush);