Fix read-only pseudo-state in QTextEdit/Browser stylesheet

Was implemented for QLineEdit but not QTextEdit.

Fixes: QTBUG-83056
Pick-to: 6.0 5.15
Change-Id: I1e67ad0f1c230a062a1e12e8bc0b209c5289dc32
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Eirik Aavitsland 2021-01-12 17:51:26 +01:00
parent ee409a536e
commit 2054f451b1

View File

@ -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)) {
@ -2527,6 +2535,11 @@ static quint64 extendedPseudoClass(const QWidget *w)
if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(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;