diff options
author | James Turner <james.turner@kdab.com> | 2015-06-24 10:17:04 +0100 |
---|---|---|
committer | James Turner <james.turner@kdab.com> | 2015-07-09 10:53:17 +0000 |
commit | 130c2baa9376dcf525916620294bd9996bdf41f3 (patch) | |
tree | 8933d343ad45d17400aafd1d6533a94a6594e1d0 /src/gui/image/qicon.cpp | |
parent | bd4ff0b552d5c31eaf35d67208d003b132a4ffba (diff) |
Add ability for QIcons to be marked as template images.
This allows end users to create QSystemTrayIcons that are properly
displayed as monochrome images on OS X, which is especially important
on Yosemite and above when Dark Mode is turned on.
[ChangeLog][QtGui][QIcon] Add ability for QIcons to be marked
as template images. This allows end users to create QSystemTrayIcons
that are properly displayed as monochrome images on OS X, which is
especially important on Yosemite and above when Dark Mode is turned on.
Task-number: QTBUG-42109
Change-Id: I095fb71355ffa572d0abb4769341f68b89b877c4
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'src/gui/image/qicon.cpp')
-rw-r--r-- | src/gui/image/qicon.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 60b5b6abd0..40b33b5359 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -129,7 +129,8 @@ static qreal qt_effective_device_pixel_ratio(QWindow *window = 0) QIconPrivate::QIconPrivate() : engine(0), ref(1), serialNum(serialNumCounter.fetchAndAddRelaxed(1)), - detach_no(0) + detach_no(0), + is_mask(false) { } @@ -1196,6 +1197,31 @@ bool QIcon::hasThemeIcon(const QString &name) return icon.name() == name; } +/*! + \since 5.6 + + Indicate that this icon is a mask image, and hence can potentially + be modified based on where it's displayed. + \sa isMask() +*/ +void QIcon::setIsMask(bool isMask) +{ + d->is_mask = isMask; +} + +/*! + \since 5.6 + + Returns \c true if this icon has been marked as a mask image. + Certain platforms render mask icons differently (for example, + menu icons on OS X). + + \sa setIsMask() +*/ +bool QIcon::isMask() const +{ + return d->is_mask; +} /***************************************************************************** QIcon stream functions |