qt5base-lts/tests/auto/gui/text
Volker Hilsheimer cb27ed30f7 QCSS: Support Qt 5-style integer property selectors
In Qt 5 style sheets, objects could be selected by an enum-type property
using the integer value of the enum value, e.g

QToolButton[popupMode="1"] { ... }

In Qt 6, the the new meta type system and QVariant implementation enabled
QVariant::toString to return the string representation of the enum value
instead for a property containing an enum. Since QStyleSheetStyle's
attribute matching is string based, this breaks the Qt 5 style selector,
and QCSS code instead needs to use e.g.

QToolButton[popupMode=MenuButtonPopup] { ... }

While the new syntax is arguably preferable, this is an unintentional
change that silently breaks style sheet code (no error or warning at
compile- or run-time).

To support Qt 5-style selectors, we have to change the StyleSelector
interface of the QCssParser API so that we can pass through what type
of value the attribute extractor should return; if an integer string "1"
is provided, then we need to compare the enum integer value; if the
string provided does not represent a number, then we need to compare the
name of the enum value.

Since the pure virtual attribute() method that needs to be implemented
to extract the attribute value of the node is implemented in modules
outside qtbase, add a second virtual method that takes the entire
QCss::AttributeSelector, which includes the value to match. Extractor
implementations can use it to evaluate which type of data to return for
an exact match. The default implementation calls the old attribute()
method so that existing StyleSelector implementations continue to work.

Make the respective change in the QStyleSheetStyleSelector, and simplify
the surrounding code. Adjust other StyleSelector implemnentations in
qtbase. As a drive-by, remove the superfluous virtual declaration from
those overrides.

Once submodules are adjusted to override this virtual function instead
of the (now no longer pure) virtual attribute() method, that method can
be removed.

Pick-to: 6.3 6.2
Fixes: QTBUG-99642
Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-01-15 19:21:57 +01:00
..
qabstracttextdocumentlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qcssparser QCSS: Support Qt 5-style integer property selectors 2022-01-15 19:21:57 +01:00
qfont Fix deserializing Qt 5.x fonts through QDataStream 2021-11-18 23:41:02 +01:00
qfontcache QFontCache: don't start cleanup timer if we are not in the main thread 2021-10-01 16:46:48 +02:00
qfontdatabase QFontDatabase (Windows): Sanitize font requests early 2021-12-06 20:06:06 +01:00
qfontmetrics Fix overlapping text for Osaka font on macOS 2021-12-02 07:54:39 +01:00
qglyphrun Fix compiler warning: don't mix signed and unsigned int in comparison 2021-02-11 21:06:00 +01:00
qinputcontrol Remove the qmake project files 2021-01-07 15:32:28 +01:00
qrawfont Fix bug with NoFontMerging when font does not support script 2021-08-19 13:35:40 +02:00
qstatictext Remove QEXPECT_FAIL for tests that pass now on Android 2021-03-31 17:31:12 +02:00
qsyntaxhighlighter Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextblock Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextcursor Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextdocument QTextHtmlParser: fix prefix lookahead and html comments 2021-12-22 15:56:30 +01:00
qtextdocumentfragment Add QTextDocumentFragment::toRawText() 2022-01-06 07:58:39 +01:00
qtextdocumentlayout Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextformat Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextimagehandler Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextlayout Fix cursor positioning on bidi boundaries 2021-10-18 13:05:42 +02:00
qtextlist Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextmarkdownimporter Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spans 2022-01-11 15:04:25 +00:00
qtextmarkdownwriter Enable markdown writer 'preformats with embedded backticks' test 2022-01-12 00:18:35 +01:00
qtextobject Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextodfwriter tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
qtextpiecetable Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtextscriptengine Remove the qmake project files 2021-01-07 15:32:28 +01:00
qtexttable Don't let text table cells shrink below their minimum width 2021-12-02 15:16:49 +01:00
qzip Remove the qmake project files 2021-01-07 15:32:28 +01:00
CMakeLists.txt Android: exclude tests crashing at start 2020-11-16 13:35:44 +02:00