Allow QPalettePrivate to be used outside of qpalette.cpp
We need access to bitPosition in order to check if a role was set.
This fixes the following build error:
[...] qwindowstheme.cpp(1150): error C2220: the following warning is treated as an error
[...] qwindowstheme.cpp(1150): warning C4506: no definition for inline function 'QPalette::ResolveMask QPalettePrivate::bitPosition(QPalette::ColorGroup,QPalette::ColorRole)'
Amends 417878904b.
Task-number: QTBUG-116826
Change-Id: I815c7e961198ab93b6ed6132badc2ec693522472
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
bb10
parent
d70b873c37
commit
303d991136
|
|
@ -11,22 +11,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
constexpr QPalette::ResolveMask QPalettePrivate::colorRoleOffset(QPalette::ColorGroup colorGroup)
|
||||
{
|
||||
// Exclude NoRole; that bit is used for Accent
|
||||
return (qToUnderlying(QPalette::NColorRoles) - 1) * qToUnderlying(colorGroup);
|
||||
}
|
||||
|
||||
constexpr QPalette::ResolveMask QPalettePrivate::bitPosition(QPalette::ColorGroup colorGroup,
|
||||
QPalette::ColorRole colorRole)
|
||||
{
|
||||
// Map Accent into NoRole for resolving purposes
|
||||
if (colorRole == QPalette::Accent)
|
||||
colorRole = QPalette::NoRole;
|
||||
|
||||
return colorRole + colorRoleOffset(colorGroup);
|
||||
}
|
||||
|
||||
static_assert(QPalettePrivate::bitPosition(QPalette::ColorGroup(QPalette::NColorGroups - 1),
|
||||
QPalette::ColorRole(QPalette::NColorRoles - 1))
|
||||
< sizeof(QPalette::ResolveMask) * CHAR_BIT,
|
||||
|
|
|
|||
|
|
@ -48,9 +48,22 @@ public:
|
|||
: QPalettePrivate(QExplicitlySharedDataPointer<Data>(new Data))
|
||||
{ }
|
||||
|
||||
static constexpr QPalette::ResolveMask colorRoleOffset(QPalette::ColorGroup colorGroup);
|
||||
static constexpr QPalette::ResolveMask colorRoleOffset(QPalette::ColorGroup colorGroup)
|
||||
{
|
||||
// Exclude NoRole; that bit is used for Accent
|
||||
return (qToUnderlying(QPalette::NColorRoles) - 1) * qToUnderlying(colorGroup);
|
||||
}
|
||||
|
||||
static constexpr QPalette::ResolveMask bitPosition(QPalette::ColorGroup colorGroup,
|
||||
QPalette::ColorRole colorRole);
|
||||
QPalette::ColorRole colorRole)
|
||||
{
|
||||
// Map Accent into NoRole for resolving purposes
|
||||
if (colorRole == QPalette::Accent)
|
||||
colorRole = QPalette::NoRole;
|
||||
|
||||
return colorRole + colorRoleOffset(colorGroup);
|
||||
}
|
||||
|
||||
QAtomicInt ref;
|
||||
QPalette::ResolveMask resolveMask = {0};
|
||||
static inline int qt_palette_count = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue