summaryrefslogtreecommitdiffstats
path: root/src/gui/doc/snippets/textdocument-listitems
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-12-06 16:03:53 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-12-07 12:39:06 +0100
commit5f1fffc00e9093c3691ea4182b4e202d29c0cea6 (patch)
tree3f066488beae687d634ae36091630a2d0a42e0f3 /src/gui/doc/snippets/textdocument-listitems
parent8988c92b98c07d684fae655fbdf8791b99231e9e (diff)
QIcon: add theme icon constants
Add a list of constant string literals for a subset of icons from the freedesktop specification. Those are icons we document to support today, and that users might have written themes for. Omit icons that are mime types (we have Q(Abstract)FileIconProvider and QPlatformTheme::fileIcon for that), the "flag-aa" icon (where 'aa' is an ISO 3166 country code, and Face* icons. Flags and Face icons can be added as supported QIcon constants, but should then be rendered as emojis from the respective font (they are not provided by any of the native icon libraries or icon fonts). We use string constants instead of an enum so that we have the same code path for icon constants, user-defined icons, and native icons. I.e. in addition to QIcon::fromTheme(QIcon::ThemeIcon::EditCopy), code can request the icon for "trash.circle.fill" on Apple platforms, or or for U"\ue5cd" on platforms where the engine is font-based; or an app can define their own icon name and provide the assets through a theme- description, as before. The downside is that we cannot use arrays for looking up the native icon for an enum-value in the engine implementations, but given that icons are cached this is an acceptable trade-off. To make the list of icon contants more manageable, have them in a separate header file. Since we want those constants to live in the QIcon "namespace", we then include that header in a declaration of a nested struct, "ThemeIcon", resulting in e.g. QIcon::ThemeIcon::EditCopy. Change-Id: Ic20e36ab321e6c4b20806ec0b400bba13fffc983 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/doc/snippets/textdocument-listitems')
0 files changed, 0 insertions, 0 deletions