qt6-bb10/src/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
..
coretext Trust CoreText-provided vertical metrics on macOS 2021-12-10 23:15:39 +01:00
freetype Freetype: adjust underlinePosition to match our expectations 2021-12-02 12:53:34 +01:00
unix Update UCD to Revision 28 2021-10-18 16:45:10 +00:00
windows Use ranged for loops instead of QString::utf16 2022-01-07 14:31:38 +01:00
AGLFN_LICENSE.txt
qabstracttextdocumentlayout.cpp
qabstracttextdocumentlayout.h
qabstracttextdocumentlayout_p.h
qcssparser.cpp QCSS: Support Qt 5-style integer property selectors 2022-01-15 19:21:57 +01:00
qcssparser_p.h QCSS: Support Qt 5-style integer property selectors 2022-01-15 19:21:57 +01:00
qcssscanner.cpp
qdistancefield.cpp Implement vertical subpixel positioning where available 2021-01-25 15:56:50 +01:00
qdistancefield_p.h
qfont.cpp Fix deserializing Qt 5.x fonts through QDataStream 2021-11-18 23:41:02 +01:00
qfont.h Undeprecate QFont(QString) since this is still useful for many 2021-08-11 08:19:45 +02:00
qfont_p.h QFontCache: don't start cleanup timer if we are not in the main thread 2021-10-01 16:46:48 +02:00
qfontdatabase.cpp Avoid crash on app startup if the default font family is empty 2022-01-03 09:00:04 +01:00
qfontdatabase.h QFontDatabase: suppress warning about its constructor being deprecated 2021-10-16 11:59:10 -07:00
qfontdatabase_p.h Fix bug with NoFontMerging when font does not support script 2021-08-19 13:35:40 +02:00
qfontengine.cpp Fix overlapping text for Osaka font on macOS 2021-12-02 07:54:39 +01:00
qfontengine_p.h Implement vertical subpixel positioning where available 2021-01-25 15:56:50 +01:00
qfontengineglyphcache.cpp
qfontengineglyphcache_p.h
qfontinfo.h
qfontmetrics.cpp Add QFontMetricsF methods taking text options into account 2021-10-22 01:05:43 +02:00
qfontmetrics.h Add QFontMetricsF methods taking text options into account 2021-10-22 01:05:43 +02:00
qfontsubset.cpp Use ranged for loops instead of QString::utf16 2022-01-07 14:31:38 +01:00
qfontsubset_agl.cpp
qfontsubset_p.h
qfragmentmap.cpp
qfragmentmap_p.h
qglyphrun.cpp QGlyphRun: always use stored bounding rect even if it's empty 2021-12-13 16:43:47 +00:00
qglyphrun.h
qglyphrun_p.h
qharfbuzzng.cpp Update UCD to Revision 28 2021-10-18 16:45:10 +00:00
qharfbuzzng_p.h
qinputcontrol.cpp QInputControl: accept surrogate category character 2021-01-05 16:24:29 +01:00
qinputcontrol_p.h
qplatformfontdatabase.cpp QPlatformFontDatabase: Don't copy metaobjects 2021-10-07 11:25:24 +02:00
qplatformfontdatabase.h
qrawfont.cpp Fix bug with NoFontMerging when font does not support script 2021-08-19 13:35:40 +02:00
qrawfont.h
qrawfont_p.h
qstatictext.cpp
qstatictext.h
qstatictext_p.h Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE 2020-11-30 17:16:21 +01:00
qsyntaxhighlighter.cpp Use (new) erase()/erase_if() algorithms 2020-12-05 00:47:44 +01:00
qsyntaxhighlighter.h
qt_attribution.json
qtextcursor.cpp gui: Fix typos in source code comments 2021-10-12 12:52:02 +02:00
qtextcursor.h
qtextcursor_p.h
qtextdocument.cpp Add css media rule support for QTextDocument::setHtml() 2021-12-15 11:36:37 +00:00
qtextdocument.h Add css media rule support for QTextDocument::setHtml() 2021-12-15 11:36:37 +00:00
qtextdocument_p.cpp Add css media rule support for QTextDocument::setHtml() 2021-12-15 11:36:37 +00:00
qtextdocument_p.h Add css media rule support for QTextDocument::setHtml() 2021-12-15 11:36:37 +00:00
qtextdocumentfragment.cpp Add QTextDocumentFragment::toRawText() 2022-01-06 07:58:39 +01:00
qtextdocumentfragment.h Add QTextDocumentFragment::toRawText() 2022-01-06 07:58:39 +01:00
qtextdocumentfragment_p.h Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE 2020-11-30 17:16:21 +01:00
qtextdocumentlayout.cpp Use block char format to render list item bullets and numbers 2022-01-05 00:11:28 +01:00
qtextdocumentlayout_p.h
qtextdocumentwriter.cpp Doc: Fix various documentation issues 2021-03-16 13:17:39 +01:00
qtextdocumentwriter.h
qtextengine.cpp Fix crash when text shaping fails 2022-01-14 18:57:41 +01:00
qtextengine_p.h Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE 2020-11-30 17:16:21 +01:00
qtextformat.cpp Doc: Fix qdoc warnngs 2021-10-23 03:08:58 +02:00
qtextformat.h QTextImageFormat::setQuality: deprecate the default value 2021-10-01 14:15:38 +02:00
qtextformat_p.h
qtexthtmlparser.cpp QCSS: Support Qt 5-style integer property selectors 2022-01-15 19:21:57 +01:00
qtexthtmlparser_p.h QTextHtmlParser: fix prefix lookahead and html comments 2021-12-22 15:56:30 +01:00
qtextimagehandler.cpp Port to QImage and QPixmap deviceIndependentSize() 2021-09-01 15:24:05 +02:00
qtextimagehandler_p.h
qtextlayout.cpp Fix gaps between lines of selection 2021-11-29 16:25:38 +01:00
qtextlayout.h Remove Qt6 switches from QtGui 2021-05-05 19:26:56 +02:00
qtextlist.cpp
qtextlist.h
qtextmarkdownimporter.cpp Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spans 2022-01-11 15:04:25 +00:00
qtextmarkdownimporter_p.h
qtextmarkdownwriter.cpp Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spans 2022-01-11 15:04:25 +00:00
qtextmarkdownwriter_p.h
qtextobject.cpp gui: Fix typos in documentation 2021-10-12 12:52:02 +02:00
qtextobject.h Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE 2020-11-30 17:16:21 +01:00
qtextobject_p.h
qtextodfwriter.cpp QTextOdfWriter: fix exporting pixmaps to ODT 2021-09-08 15:43:16 +02:00
qtextodfwriter_p.h
qtextoption.cpp gui: Fix typos in documentation 2021-10-12 12:52:02 +02:00
qtextoption.h
qtexttable.cpp
qtexttable.h
qtexttable_p.h
qzip.cpp QZipReader: update to unzip partly broken archives 2021-12-19 18:58:40 +01:00
qzipreader_p.h Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE 2020-11-30 17:16:21 +01:00
qzipwriter_p.h