diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2021-01-12 17:51:26 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-01-13 19:34:34 +0000 |
commit | 4b3417f0f41b6b62091c90ca35bbbed2b232c354 (patch) | |
tree | 2d899f8859203fd2c6ad44be5cb126b48d7a5144 /src | |
parent | 133e989cee5b4e3b32afa10618d700c0590a9c63 (diff) |
Fix read-only pseudo-state in QTextEdit/Browser stylesheet
Was implemented for QLineEdit but not QTextEdit.
Fixes: QTBUG-83056
Change-Id: I1e67ad0f1c230a062a1e12e8bc0b209c5289dc32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 2054f451b1fc182fb3f53976b8f1e0026cfcd89a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 6d3a9fcfeb..e7662ba5c6 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -57,6 +57,9 @@ #if QT_CONFIG(lineedit) #include <qlineedit.h> #endif +#if QT_CONFIG(textedit) +#include <qtextedit.h> +#endif #include <private/qwindowsstyle_p.h> #if QT_CONFIG(combobox) #include <qcombobox.h> @@ -2103,6 +2106,11 @@ QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption } #endif +#if QT_CONFIG(textedit) + else if (const QTextEdit *edit = qobject_cast<const QTextEdit *>(obj)) { + extraClass |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable); + } +#endif #if QT_CONFIG(lineedit) // LineEdit sets Sunken flag to indicate Sunken frame (argh) if (const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(obj)) { @@ -2528,6 +2536,11 @@ static quint64 extendedPseudoClass(const QWidget *w) pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable); } else #endif +#if QT_CONFIG(textedit) + if (const QTextEdit *edit = qobject_cast<const QTextEdit *>(w)) { + pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable); + } else +#endif { } // required for the above ifdef'ery to work return pc; } |