This reverts 59bbfb17db563d7e62b9f3158dab3cc6e7e68acd and
c853054910552f5fef04797222dde0d29a0c340d, as that approach
was causing issues for QCommonStyle::iconFromWindowsTheme,
for example in situations where the system has a 1x and 2.5x
screen, and the user requests a 16x16 pixmap or icon via
QStyle::standardPixmap or QStyle::standardIcon. In that
situation our smallest pixmap is 40x40, and we need to
downscale, causing blurred results on a 1x screen.
Change-Id: Ifa6e15d37d15954df689253c32eaa779885c567b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit d884abaf8bdc1be74ee52306948c0be1986d738d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
If the QIcon::themeName matches an installed font, and if the
name of the icon matches a named glyph in the font, then render
that glyph as a painter path.
Overrides of QFontIconEngine::text() take priority.
Amend the manual test to allow specifying an icon theme on the
command line, and render the named glyph also as text, as
some icon fonts will define ligatures that turn the string into
the corresponding icon.
Task-number: QTBUG-102346
Change-Id: I788c6274322359955cbfe58175a2999a57cfce95
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Which uses the platform theme under the hood, but returns QIcon
instead of QPixmap.
We now also render the platform pixmaps as 64x64 to more easily compare
the rendering to the other APIs.
Change-Id: I1418c8c144747b25d4cc39cad887560931ea7a1d
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
In icon mode, the name of the icon gets truncated.
Pick-to: 6.7
Change-Id: I8e2081a68006907ae916c8e8fa1aeb6006acbc6d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only
[1]: https://contribute.qt-project.org/quips/18
Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
They are used when an icon is constructed via QIcon::fromTheme, unless
an application-defined theme provides the requested icon. Update the
documentation.
For now we don't provide a way to "opt out". This might change,
depending on the feedback during the Qt 6.7 beta phase.
[ChangeLog][QtGui][QIcon] Qt now has implementations of native icon
engines for macOS, iOS, Windows 10, Windows 11, and Android. These
engines provide access to the native icon libraries and fonts, mapping
standard icons to the corresponding native icon asset. Icons from
application-defined themes take precedence, but the last-resort fallback
icon passed as the second parameter into the
QIcon::fromTheme(QString, QIcon) overload is only used if the icon is
not available from the native library. See the QIcon documentation for
details.
Change-Id: I618e5c137c40f8e6309c0e4d4219a5a2759a475d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Try to use the Downloadable Font APIs from AndroidX to download the
Material Symbols font. This would ideally allow us to add the official
icon variations dynamically to the device's font cache.
This works for several fonts from Google Fonts, but not for the fonts
we need. So, for the time being, add a path where we consult the
resource system for an embedded font file as well. Then an application
can add e.g. the font file for the desired icons variation, and Qt will
use those glyphs to render icons. Do this in the manual test, using
cmake's FetchContent feature to download the font from Googlei's github
repository.
The incomplete mapping is based on the standard Material icons
documentation at https://fonts.google.com/icons. We could in theory use
the `codepoints` file that comes with the font files to create the
mapping, but then we'd end up with platform specific icon names.
Task-number: QTBUG-102346
Change-Id: Ibff3fe6d310a388e6111d983815ef0ddffb684c8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
From macOS 13 on, AppKit provides an API to get a scalable system image
from a symbolic icon name. We can map those icon names to the XDG-based
icon names we support in Qt, and render the NSImage with palette-based
coloring when needed, in an appropriate scale.
On iOS, we can use the equivalent UIKit APIs. Coloring functionality is
only available from iOS 15 on.
Implement a QAppleIconEngine that does that in its scaledPixmap
implementation. Use basic caching to store a single QPixmap version of
the native vector image. We regenerate the pixmap whenever a different
size, mode, or state is requested.
Add a manual test for browsing all icons we can get from the various Qt
APIs that: standard icons and pixmaps from QStyle, QPlatformTheme, and
QIcon::fromTheme, in addition to showing all icon variations for a
single QIcon.
Task-number: QTBUG-102346
Change-Id: If5ab683ec18d140bd8700ac99b0edada980de9b4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>