diff options
author | Alejandro Exojo <alex@vikingsoftware.com> | 2018-07-11 17:33:29 +0200 |
---|---|---|
committer | Alejandro Exojo (Viking Software) <alex@vikingsoftware.com> | 2018-12-31 14:30:26 +0000 |
commit | 7f34e8b58ca51b8ce0b0d7757ae903ac9e940c80 (patch) | |
tree | 0fe8d861f337b6a02c178735254baedec662205b /src/gui/kernel/qpalette.cpp | |
parent | 7ef0b575b38d267bd3dc14ff46935d556562ff00 (diff) |
Fix and unit test QPalette::resolve
The function is setting the brushes correctly in the return value, but
without updating the resolve_mask, making it return wrong results in
functions like isBrushSet or the debug operator.
Added a unit test for the member function, since the class is still
mostly untested, and clarified the reference documentation of what the
function is supposed to do.
Change-Id: Iaa820dc44f095e125f9375cb00da5569986803c6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/gui/kernel/qpalette.cpp')
-rw-r--r-- | src/gui/kernel/qpalette.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 16b1f847bd..b4383c5bfc 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -941,7 +941,8 @@ qint64 QPalette::cacheKey() const } /*! - Returns a new QPalette that has attributes copied from \a other. + Returns a new QPalette that is a union of this instance and \a other. + Color roles set in this instance take precedence. */ QPalette QPalette::resolve(const QPalette &other) const { @@ -959,6 +960,7 @@ QPalette QPalette::resolve(const QPalette &other) const if (!(data.resolve_mask & (1<<role))) for(int grp = 0; grp < (int)NColorGroups; grp++) palette.d->br[grp][role] = other.d->br[grp][role]; + palette.data.resolve_mask |= other.data.resolve_mask; return palette; } |