QskAspect::States introduced to be more accurate about state vs. states
This commit is contained in:
parent
e1a4e1fec3
commit
4092ec0a8a
@ -342,7 +342,7 @@ void Editor::setupPushButton()
|
||||
|
||||
for ( auto state2 : { A::NoState, Q::Hovered } )
|
||||
{
|
||||
for ( auto state3 : { Q::Pressed, Q::Checked, Q::Checked | Q::Pressed } )
|
||||
for ( auto state3 : { Q::Pressed | A::NoState, Q::Checked | A::NoState, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
const auto states = state1 | state2 | state3;
|
||||
|
||||
@ -393,7 +393,7 @@ void Editor::setupDialogButton()
|
||||
|
||||
for ( auto state2 : { A::NoState, Q::Hovered } )
|
||||
{
|
||||
for ( auto state3 : { Q::Pressed, Q::Checked, Q::Checked | Q::Pressed } )
|
||||
for ( auto state3 : { Q::Pressed | A::NoState, Q::Checked | A::NoState, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
const auto states = state1 | state2 | state3;
|
||||
|
||||
@ -467,12 +467,12 @@ void Editor::setupSlider()
|
||||
setGradient( Q::Handle, m_pal.accentColor );
|
||||
setGradient( Q::Handle | Q::Pressed, m_pal.accentColor );
|
||||
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
for ( auto state : { A::States(), Q::Pressed | A::NoState, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
setBoxBorderColors( Q::Handle | state, m_pal.accentColor );
|
||||
}
|
||||
|
||||
for ( auto state : { A::NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
for ( auto state : { A::States(), Q::Pressed | A::NoState, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
const auto aspect = Q::Handle | Q::Minimum | state;
|
||||
setGradient( aspect, Grey300 );
|
||||
|
@ -507,7 +507,7 @@ void Editor::setupTabButton()
|
||||
setGradient( Q::Panel | placement,
|
||||
QskGradient( Qt::Vertical, m_pal.lighter125, m_pal.lighter110 ) );
|
||||
|
||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||
for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
setGradient( Q::Panel | placement | state, m_pal.lighter125 );
|
||||
setColor( Q::Text | placement | state, m_pal.themeForeground );
|
||||
@ -518,7 +518,7 @@ void Editor::setupTabButton()
|
||||
{
|
||||
setGradient( Q::Panel | placement, m_pal.lighter125 );
|
||||
|
||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||
for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } )
|
||||
{
|
||||
setGradient( Q::Panel | placement | state, m_pal.highlighted );
|
||||
setColor( Q::Text | placement | state, m_pal.highlightedText );
|
||||
@ -580,7 +580,7 @@ void Editor::setupTabButton()
|
||||
|
||||
setMargin( aspect, margins0 );
|
||||
|
||||
for ( const auto state : { Q::Checked, Q::Checked | Q::Pressed } )
|
||||
for ( const auto state : { Q::Checked | A::NoState, Q::Checked | Q::Pressed } )
|
||||
setMargin( aspect | state, margins1 );
|
||||
|
||||
setPadding( aspect, padding );
|
||||
|
@ -172,17 +172,17 @@ static QByteArray qskStateKey( const QMetaObject* metaObject, quint16 state )
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
static QByteArray qskStateString(
|
||||
const QMetaObject* metaObject, QskAspect::State state )
|
||||
static QByteArray qskStatesToString(
|
||||
const QMetaObject* metaObject, QskAspect::States states )
|
||||
{
|
||||
if ( state == 0 )
|
||||
if ( states == 0 )
|
||||
{
|
||||
return "NoState";
|
||||
}
|
||||
|
||||
if ( metaObject == nullptr )
|
||||
{
|
||||
const std::bitset< 16 > stateBits( state );
|
||||
const std::bitset< 16 > stateBits( states );
|
||||
return stateBits.to_string().c_str();
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ static QByteArray qskStateString(
|
||||
{
|
||||
const quint16 mask = 1 << i;
|
||||
|
||||
if ( state & mask )
|
||||
if ( states & mask )
|
||||
{
|
||||
if ( first )
|
||||
first = false;
|
||||
@ -206,7 +206,7 @@ static QByteArray qskStateString(
|
||||
const auto key = qskStateKey( metaObject, mask );
|
||||
if ( key.isEmpty() )
|
||||
{
|
||||
const std::bitset< 16 > stateBits( state );
|
||||
const std::bitset< 16 > stateBits( states );
|
||||
stateString += stateBits.to_string().c_str();
|
||||
}
|
||||
else
|
||||
@ -255,9 +255,9 @@ QDebug operator<<( QDebug debug, QskAspect::Placement placement )
|
||||
return debug;
|
||||
}
|
||||
|
||||
QDebug operator<<( QDebug debug, QskAspect::State state )
|
||||
QDebug operator<<( QDebug debug, QskAspect::States states )
|
||||
{
|
||||
qskDebugState( debug, nullptr, state );
|
||||
qskDebugStates( debug, nullptr, states );
|
||||
return debug;
|
||||
}
|
||||
|
||||
@ -267,7 +267,8 @@ QDebug operator<<( QDebug debug, QskAspect aspect )
|
||||
return debug;
|
||||
}
|
||||
|
||||
void qskDebugState( QDebug debug, const QMetaObject* metaObject, QskAspect::State state )
|
||||
void qskDebugStates( QDebug debug,
|
||||
const QMetaObject* metaObject, QskAspect::States states )
|
||||
{
|
||||
QDebugStateSaver saver( debug );
|
||||
|
||||
@ -275,7 +276,7 @@ void qskDebugState( QDebug debug, const QMetaObject* metaObject, QskAspect::Stat
|
||||
debug.noquote();
|
||||
debug.nospace();
|
||||
|
||||
debug << "QskAspect::State( " << qskStateString( metaObject, state ) << " )";
|
||||
debug << "QskAspect::States( " << qskStatesToString( metaObject, states ) << " )";
|
||||
}
|
||||
|
||||
void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect aspect )
|
||||
@ -322,8 +323,8 @@ void qskDebugAspect( QDebug debug, const QMetaObject* metaObject, QskAspect aspe
|
||||
if ( aspect.placement() != QskAspect::NoPlacement )
|
||||
debug << ", " << qskEnumString( "Placement", aspect.placement() );
|
||||
|
||||
if ( aspect.state() )
|
||||
debug << ", " << qskStateString( metaObject, aspect.state() );
|
||||
if ( aspect.hasStates() )
|
||||
debug << ", " << qskStatesToString( metaObject, aspect.states() );
|
||||
|
||||
debug << " )";
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define QSK_ASPECT_H
|
||||
|
||||
#include "QskGlobal.h"
|
||||
#include "QskFlags.h"
|
||||
|
||||
#include <qmetaobject.h>
|
||||
#include <qnamespace.h>
|
||||
@ -89,6 +88,7 @@ class QSK_EXPORT QskAspect
|
||||
AllStates = 0xFFFF
|
||||
};
|
||||
Q_ENUM( State )
|
||||
Q_DECLARE_FLAGS( States, State )
|
||||
|
||||
constexpr QskAspect() noexcept;
|
||||
constexpr QskAspect( Subcontrol ) noexcept;
|
||||
@ -110,6 +110,7 @@ class QSK_EXPORT QskAspect
|
||||
constexpr QskAspect operator|( Primitive ) const noexcept;
|
||||
constexpr QskAspect operator|( Placement ) const noexcept;
|
||||
constexpr QskAspect operator|( State ) const noexcept;
|
||||
constexpr QskAspect operator|( States ) const noexcept;
|
||||
|
||||
constexpr QskAspect stateless() const noexcept;
|
||||
constexpr QskAspect trunk() const noexcept;
|
||||
@ -132,14 +133,15 @@ class QSK_EXPORT QskAspect
|
||||
constexpr Placement placement() const noexcept;
|
||||
void setPlacement( Placement ) noexcept;
|
||||
|
||||
constexpr State state() const noexcept;
|
||||
State topState() const noexcept;
|
||||
constexpr States states() const noexcept;
|
||||
constexpr bool hasStates() const noexcept;
|
||||
|
||||
void setState( State ) noexcept;
|
||||
void addState( State ) noexcept;
|
||||
constexpr bool hasState() const noexcept;
|
||||
State topState() const noexcept;
|
||||
void clearState( State ) noexcept;
|
||||
void clearStates() noexcept;
|
||||
|
||||
void setStates( States ) noexcept;
|
||||
void addStates( States ) noexcept;
|
||||
void clearStates( States = AllStates ) noexcept;
|
||||
|
||||
constexpr Primitive primitive() const noexcept;
|
||||
void setPrimitive( Type, Primitive primitive ) noexcept;
|
||||
@ -189,7 +191,20 @@ class QSK_EXPORT QskAspect
|
||||
};
|
||||
};
|
||||
|
||||
QSK_DECLARE_OPERATORS_FOR_FLAGS( QskAspect::State )
|
||||
Q_DECLARE_TYPEINFO( QskAspect, Q_MOVABLE_TYPE );
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QskAspect::States )
|
||||
|
||||
constexpr inline QskAspect::State operator<<( QskAspect::State a, const int b ) noexcept
|
||||
{
|
||||
using underlying = typename std::underlying_type< QskAspect::State >::type;
|
||||
return static_cast< QskAspect::State >( static_cast< underlying >( a ) << b );
|
||||
}
|
||||
|
||||
constexpr inline QskAspect::State operator>>( QskAspect::State a, const int b ) noexcept
|
||||
{
|
||||
using underlying = typename std::underlying_type< QskAspect::State >::type;
|
||||
return static_cast< QskAspect::State >( static_cast< underlying >( a ) >> b );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::QskAspect() noexcept
|
||||
: QskAspect( Control, Flag, NoPlacement )
|
||||
@ -268,6 +283,12 @@ inline constexpr QskAspect QskAspect::operator|( State state ) const noexcept
|
||||
m_bits.primitive, m_bits.placement, m_bits.states | state );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::operator|( States states ) const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
m_bits.primitive, m_bits.placement, m_bits.states | states );
|
||||
}
|
||||
|
||||
inline constexpr QskAspect QskAspect::stateless() const noexcept
|
||||
{
|
||||
return QskAspect( m_bits.subControl, m_bits.type, m_bits.isAnimator,
|
||||
@ -330,22 +351,22 @@ inline constexpr bool QskAspect::isFlag() const noexcept
|
||||
return type() == Flag;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::State QskAspect::state() const noexcept
|
||||
inline constexpr QskAspect::States QskAspect::states() const noexcept
|
||||
{
|
||||
return static_cast< State >( m_bits.states );
|
||||
return static_cast< States >( m_bits.states );
|
||||
}
|
||||
|
||||
inline void QskAspect::setState( State state ) noexcept
|
||||
inline void QskAspect::setStates( States states ) noexcept
|
||||
{
|
||||
m_bits.states = state;
|
||||
m_bits.states = states;
|
||||
}
|
||||
|
||||
inline void QskAspect::addState( State state ) noexcept
|
||||
inline void QskAspect::addStates( States states ) noexcept
|
||||
{
|
||||
m_bits.states |= state;
|
||||
m_bits.states |= states;
|
||||
}
|
||||
|
||||
inline constexpr bool QskAspect::hasState() const noexcept
|
||||
inline constexpr bool QskAspect::hasStates() const noexcept
|
||||
{
|
||||
return m_bits.states;
|
||||
}
|
||||
@ -355,9 +376,9 @@ inline void QskAspect::clearState( State state ) noexcept
|
||||
m_bits.states &= ~state;
|
||||
}
|
||||
|
||||
inline void QskAspect::clearStates() noexcept
|
||||
inline void QskAspect::clearStates( States states ) noexcept
|
||||
{
|
||||
m_bits.states = 0;
|
||||
m_bits.states &= ~states;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect::Primitive QskAspect::primitive() const noexcept
|
||||
@ -410,6 +431,12 @@ inline constexpr QskAspect operator|(
|
||||
return aspect | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::States states, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
return aspect | states;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, const QskAspect& aspect ) noexcept
|
||||
{
|
||||
@ -446,6 +473,12 @@ inline constexpr QskAspect operator|(
|
||||
return QskAspect( subControl ) | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::States states ) noexcept
|
||||
{
|
||||
return QskAspect( subControl ) | states;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Type type, QskAspect::Placement placement ) noexcept
|
||||
{
|
||||
@ -464,6 +497,12 @@ inline constexpr QskAspect operator|(
|
||||
return subControl | state;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::States states, QskAspect::Subcontrol subControl ) noexcept
|
||||
{
|
||||
return subControl | states;
|
||||
}
|
||||
|
||||
inline constexpr QskAspect operator|(
|
||||
QskAspect::Subcontrol subControl, QskAspect::Primitive primitive ) noexcept
|
||||
{
|
||||
@ -499,8 +538,6 @@ namespace std
|
||||
};
|
||||
}
|
||||
|
||||
Q_DECLARE_TYPEINFO( QskAspect, Q_MOVABLE_TYPE );
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
||||
class QDebug;
|
||||
@ -510,9 +547,9 @@ QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Type );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Subcontrol );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Primitive );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::Placement );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::State );
|
||||
QSK_EXPORT QDebug operator<<( QDebug, QskAspect::States );
|
||||
|
||||
QSK_EXPORT void qskDebugState( QDebug, const QMetaObject*, QskAspect::State );
|
||||
QSK_EXPORT void qskDebugStates( QDebug, const QMetaObject*, QskAspect::States );
|
||||
QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect );
|
||||
|
||||
#endif
|
||||
|
@ -1,87 +0,0 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_FLAGS_H_
|
||||
#define QSK_FLAGS_H_
|
||||
|
||||
#include "QskGlobal.h"
|
||||
#include <functional>
|
||||
|
||||
#define QSK_DECLARE_OPERATORS_FOR_FLAGS( Flags ) \
|
||||
constexpr inline Flags operator|( const Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( \
|
||||
static_cast< underlying >( a ) \
|
||||
| static_cast< underlying >( b ) ); \
|
||||
} \
|
||||
\
|
||||
inline Flags& operator|=( Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
return ( a = a | b ); \
|
||||
} \
|
||||
\
|
||||
constexpr inline Flags operator&( const Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( \
|
||||
static_cast< underlying >( a ) & static_cast< underlying >( b ) ); \
|
||||
} \
|
||||
\
|
||||
inline Flags& operator&=( Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
return ( a = static_cast< Flags >( a & b ) ); \
|
||||
} \
|
||||
\
|
||||
constexpr inline Flags operator~( const Flags& a ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( \
|
||||
~static_cast< underlying >( a ) ); \
|
||||
} \
|
||||
\
|
||||
constexpr inline Flags operator^( const Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( \
|
||||
static_cast< underlying >( a ) ^ static_cast< underlying >( b ) ); \
|
||||
} \
|
||||
\
|
||||
inline Flags& operator^=( Flags& a, const Flags& b ) noexcept \
|
||||
{ \
|
||||
return ( a = a ^ b ); \
|
||||
} \
|
||||
\
|
||||
constexpr inline Flags operator<<( const Flags& a, const int& b ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( static_cast< underlying >( a ) << b ); \
|
||||
} \
|
||||
\
|
||||
constexpr inline Flags operator>>( const Flags& a, const int& b ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< Flags >( static_cast< underlying >( a ) >> b ); \
|
||||
} \
|
||||
\
|
||||
constexpr bool operator!( const Flags& a ) noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return !static_cast< underlying >( a ); \
|
||||
} \
|
||||
\
|
||||
namespace std \
|
||||
{ \
|
||||
template< > struct hash< Flags > \
|
||||
{ \
|
||||
constexpr size_t operator()( const Flags& element ) const noexcept \
|
||||
{ \
|
||||
using underlying = typename std::underlying_type< Flags >::type; \
|
||||
return static_cast< underlying >( element ); \
|
||||
} \
|
||||
}; \
|
||||
}
|
||||
|
||||
#endif
|
14
src/common/QskStateCombination.cpp
Normal file
14
src/common/QskStateCombination.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskStateCombination.h"
|
||||
|
||||
static void qskRegisterStateCombination()
|
||||
{
|
||||
qRegisterMetaType< QskStateCombination >();
|
||||
}
|
||||
|
||||
Q_CONSTRUCTOR_FUNCTION( qskRegisterStateCombination )
|
||||
|
93
src/common/QskStateCombination.h
Normal file
93
src/common/QskStateCombination.h
Normal file
@ -0,0 +1,93 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||
* This file may be used under the terms of the QSkinny License, Version 1.0
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_STATE_COMBINATION_H
|
||||
#define QSK_STATE_COMBINATION_H
|
||||
|
||||
#include "QskAspect.h"
|
||||
|
||||
class QSK_EXPORT QskStateCombination
|
||||
{
|
||||
public:
|
||||
enum Type
|
||||
{
|
||||
Combination,
|
||||
CombinationNoState
|
||||
};
|
||||
|
||||
constexpr QskStateCombination( QskAspect::State ) noexcept;
|
||||
constexpr QskStateCombination( QskAspect::States = QskAspect::States() ) noexcept;
|
||||
constexpr QskStateCombination( Type, QskAspect::States = QskAspect::States() ) noexcept;
|
||||
|
||||
constexpr bool isNull() const noexcept;
|
||||
|
||||
void setType( Type ) noexcept;
|
||||
constexpr Type type() const noexcept;
|
||||
|
||||
void setStates( QskAspect::States ) noexcept;
|
||||
void setState( QskAspect::State, bool on = true ) noexcept;
|
||||
constexpr QskAspect::States states() const noexcept;
|
||||
|
||||
private:
|
||||
Type m_type;
|
||||
QskAspect::States m_states;
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO( QskStateCombination, Q_MOVABLE_TYPE );
|
||||
Q_DECLARE_METATYPE( QskStateCombination )
|
||||
|
||||
constexpr inline QskStateCombination::QskStateCombination(
|
||||
QskAspect::State state ) noexcept
|
||||
: QskStateCombination( QskAspect::States( state ) )
|
||||
{
|
||||
}
|
||||
|
||||
constexpr inline QskStateCombination::QskStateCombination(
|
||||
QskAspect::States states ) noexcept
|
||||
: QskStateCombination( Combination, states )
|
||||
{
|
||||
}
|
||||
|
||||
constexpr inline QskStateCombination::QskStateCombination(
|
||||
Type type, QskAspect::States states ) noexcept
|
||||
: m_type( type )
|
||||
, m_states( states )
|
||||
{
|
||||
}
|
||||
|
||||
constexpr bool QskStateCombination::isNull() const noexcept
|
||||
{
|
||||
return ( m_type == Combination ) && ( m_states == QskAspect::States() );
|
||||
}
|
||||
|
||||
inline void QskStateCombination::setType( Type type ) noexcept
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
constexpr inline QskStateCombination::Type QskStateCombination::type() const noexcept
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline void QskStateCombination::setStates( QskAspect::States states ) noexcept
|
||||
{
|
||||
m_states = states;
|
||||
}
|
||||
|
||||
inline void QskStateCombination::setState( QskAspect::State state, bool on ) noexcept
|
||||
{
|
||||
if ( on )
|
||||
m_states |= state;
|
||||
else
|
||||
m_states &= ~state;
|
||||
}
|
||||
|
||||
constexpr inline QskAspect::States QskStateCombination::states() const noexcept
|
||||
{
|
||||
return m_states;
|
||||
}
|
||||
|
||||
#endif
|
@ -125,7 +125,7 @@ class QskSkin::PrivateData
|
||||
std::unordered_map< const QMetaObject*, SkinletData > skinletMap;
|
||||
|
||||
QskSkinHintTable hintTable;
|
||||
QskAspect::State stateMask = QskAspect::AllStates;
|
||||
QskAspect::States stateMask = QskAspect::AllStates;
|
||||
|
||||
std::unordered_map< int, QFont > fonts;
|
||||
std::unordered_map< int, QskColorFilter > graphicFilters;
|
||||
@ -331,7 +331,7 @@ const int* QskSkin::dialogButtonLayout( Qt::Orientation orientation ) const
|
||||
return QPlatformDialogHelper::buttonLayout( orientation, policy );
|
||||
}
|
||||
|
||||
void QskSkin::setStateMask( QskAspect::State mask )
|
||||
void QskSkin::setStateMask( QskAspect::States mask )
|
||||
{
|
||||
for ( auto state : { QskControl::Disabled, QskControl::Hovered, QskControl::Focused } )
|
||||
{
|
||||
@ -342,7 +342,7 @@ void QskSkin::setStateMask( QskAspect::State mask )
|
||||
}
|
||||
}
|
||||
|
||||
QskAspect::State QskSkin::stateMask() const
|
||||
QskAspect::States QskSkin::stateMask() const
|
||||
{
|
||||
return m_data->stateMask;
|
||||
}
|
||||
|
@ -76,8 +76,8 @@ class QSK_EXPORT QskSkin : public QObject
|
||||
|
||||
virtual const int* dialogButtonLayout( Qt::Orientation ) const;
|
||||
|
||||
void setStateMask( QskAspect::State );
|
||||
QskAspect::State stateMask() const;
|
||||
void setStateMask( QskAspect::States );
|
||||
QskAspect::States stateMask() const;
|
||||
|
||||
QskSkinlet* skinlet( const QMetaObject* );
|
||||
|
||||
|
@ -36,7 +36,7 @@ inline const QVariant* qskResolvedHint( QskAspect aspect,
|
||||
*/
|
||||
if ( const auto topState = aspect.topState() )
|
||||
{
|
||||
aspect.clearState( topState );
|
||||
aspect.clearStates( topState );
|
||||
continue;
|
||||
}
|
||||
#else
|
||||
@ -126,7 +126,7 @@ bool QskSkinHintTable::setHint( QskAspect aspect, const QVariant& skinHint )
|
||||
QSK_ASSERT_COUNTER( m_animatorCount );
|
||||
}
|
||||
|
||||
if ( aspect.hasState() )
|
||||
if ( aspect.hasStates() )
|
||||
{
|
||||
m_statefulCount++;
|
||||
QSK_ASSERT_COUNTER( m_statefulCount );
|
||||
@ -158,7 +158,7 @@ bool QskSkinHintTable::removeHint( QskAspect aspect )
|
||||
if ( aspect.isAnimator() )
|
||||
m_animatorCount--;
|
||||
|
||||
if ( aspect.hasState() )
|
||||
if ( aspect.hasStates() )
|
||||
m_statefulCount--;
|
||||
|
||||
if ( m_hints->empty() )
|
||||
@ -184,7 +184,7 @@ QVariant QskSkinHintTable::takeHint( QskAspect aspect )
|
||||
if ( aspect.isAnimator() )
|
||||
m_animatorCount--;
|
||||
|
||||
if ( aspect.hasState() )
|
||||
if ( aspect.hasStates() )
|
||||
m_statefulCount--;
|
||||
|
||||
if ( m_hints->empty() )
|
||||
@ -243,7 +243,7 @@ QskAspect QskSkinHintTable::resolvedAnimator(
|
||||
}
|
||||
|
||||
if ( const auto topState = aspect.topState() )
|
||||
aspect.clearState( topState );
|
||||
aspect.clearStates( topState );
|
||||
else
|
||||
break;
|
||||
}
|
||||
@ -290,14 +290,14 @@ bool QskSkinHintTable::isResolutionMatching(
|
||||
if ( hasHint( aspect1 ) )
|
||||
return false;
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
aspect1.clearStates( s1 );
|
||||
}
|
||||
else if ( s2 > s1 )
|
||||
{
|
||||
if ( hasHint( aspect2 ) )
|
||||
return false;
|
||||
|
||||
aspect2.clearState( s2 );
|
||||
aspect2.clearStates( s2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -325,8 +325,8 @@ bool QskSkinHintTable::isResolutionMatching(
|
||||
return false;
|
||||
}
|
||||
|
||||
aspect1.clearState( s1 );
|
||||
aspect2.clearState( s2 );
|
||||
aspect1.clearStates( s1 );
|
||||
aspect2.clearStates( s2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
inline QskAspect::State lowestState( QskAspect::State mask )
|
||||
inline QskAspect::State lowestState( QskAspect::States mask )
|
||||
{
|
||||
using StateInt = typename std::underlying_type< QskAspect::State >::type;
|
||||
|
||||
@ -24,42 +24,42 @@ namespace
|
||||
|
||||
inline void setHintStateMask(
|
||||
QskSkinHintTable* table, QskAspect aspect, const QVariant& hint,
|
||||
QskAspect::State state, QskAspect::State mask )
|
||||
bool noState, QskAspect::States states, QskAspect::States mask )
|
||||
{
|
||||
if ( mask == 0 )
|
||||
{
|
||||
if ( state != 0 )
|
||||
table->setHint( aspect | state, hint );
|
||||
if ( noState || states != 0 )
|
||||
table->setHint( aspect | states, hint );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const auto stateBit = lowestState( mask );
|
||||
const auto stateLow = lowestState( mask );
|
||||
|
||||
mask &= ~stateBit;
|
||||
mask &= ~stateLow;
|
||||
|
||||
setHintStateMask( table, aspect, hint, state, mask );
|
||||
setHintStateMask( table, aspect, hint, state | stateBit, mask );
|
||||
setHintStateMask( table, aspect, hint, noState, states, mask );
|
||||
setHintStateMask( table, aspect, hint, noState, states | stateLow, mask );
|
||||
}
|
||||
|
||||
inline bool removeHintStateMask(
|
||||
QskSkinHintTable* table, QskAspect aspect,
|
||||
QskAspect::State state, QskAspect::State mask )
|
||||
bool noState, QskAspect::States states, QskAspect::States mask )
|
||||
{
|
||||
if ( mask == 0 )
|
||||
{
|
||||
if ( state != 0 )
|
||||
return table->removeHint( aspect | state );
|
||||
if ( noState || states != 0 )
|
||||
return table->removeHint( aspect | states );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto stateBit = lowestState( mask );
|
||||
|
||||
mask &= ~stateBit;
|
||||
const auto stateLow = lowestState( mask );
|
||||
|
||||
bool ret = removeHintStateMask( table, aspect, state, mask );
|
||||
ret |= removeHintStateMask( table, aspect, state | stateBit, mask );
|
||||
mask &= ~stateLow;
|
||||
|
||||
bool ret = removeHintStateMask( table, aspect, noState, states, mask );
|
||||
ret |= removeHintStateMask( table, aspect, noState, states | stateLow, mask );
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -126,37 +126,43 @@ QskSkinHintTable* QskSkinHintTableEditor::table() const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setHint( QskAspect aspect,
|
||||
const QVariant& hint, QskAspect::State combinationMask )
|
||||
const QVariant& hint, QskStateCombination combination )
|
||||
{
|
||||
if ( combinationMask == QskAspect::NoState )
|
||||
if ( combination.isNull() )
|
||||
{
|
||||
m_table->setHint( aspect, hint );
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool noState =
|
||||
( combination.type() == QskStateCombination::CombinationNoState );
|
||||
|
||||
setHintStateMask( m_table, aspect, hint,
|
||||
QskAspect::NoState, combinationMask );
|
||||
noState, QskAspect::States(), combination.states() );
|
||||
}
|
||||
}
|
||||
|
||||
bool QskSkinHintTableEditor::removeHint(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
if ( combinationMask == QskAspect::NoState )
|
||||
if ( combination.isNull() )
|
||||
{
|
||||
return m_table->removeHint( aspect );
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool noState =
|
||||
( combination.type() == QskStateCombination::CombinationNoState );
|
||||
|
||||
return removeHintStateMask( m_table, aspect,
|
||||
QskAspect::NoState, combinationMask );
|
||||
noState, QskAspect::States(), combination.states() );
|
||||
}
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setFlag(
|
||||
QskAspect aspect, int flag, QskAspect::State combinationMask )
|
||||
QskAspect aspect, int flag, QskStateCombination combination )
|
||||
{
|
||||
setFlagHint( aspect, flag, combinationMask );
|
||||
setFlagHint( aspect, flag, combination );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::flag( QskAspect aspect ) const
|
||||
@ -165,9 +171,9 @@ int QskSkinHintTableEditor::flag( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMetric(
|
||||
QskAspect aspect, qreal metric, QskAspect::State combinationMask )
|
||||
QskAspect aspect, qreal metric, QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspect, metric, combinationMask );
|
||||
setMetricHint( aspect, metric, combination );
|
||||
}
|
||||
|
||||
qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const
|
||||
@ -176,21 +182,21 @@ qreal QskSkinHintTableEditor::metric( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor(
|
||||
QskAspect aspect, Qt::GlobalColor color, QskAspect::State combinationMask )
|
||||
QskAspect aspect, Qt::GlobalColor color, QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspect, QColor( color ), combinationMask );
|
||||
setColorHint( aspect, QColor( color ), combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor(
|
||||
QskAspect aspect, QRgb rgb, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QRgb rgb, QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspect, QColor::fromRgba( rgb ), combinationMask );
|
||||
setColorHint( aspect, QColor::fromRgba( rgb ), combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setColor(
|
||||
QskAspect aspect, const QColor& color, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QColor& color, QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspect, color, combinationMask );
|
||||
setColorHint( aspect, color, combination );
|
||||
}
|
||||
|
||||
QColor QskSkinHintTableEditor::color( QskAspect aspect ) const
|
||||
@ -200,25 +206,25 @@ QColor QskSkinHintTableEditor::color( QskAspect aspect ) const
|
||||
|
||||
void QskSkinHintTableEditor::setHGradient(
|
||||
QskAspect aspect, const QColor& color1, const QColor& color2,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
const QskGradient gradient( QskGradient::Horizontal, color1, color2 );
|
||||
setGradient( aspect, gradient, combinationMask );
|
||||
setGradient( aspect, gradient, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setVGradient(
|
||||
QskAspect aspect, const QColor& color1, const QColor& color2,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
const QskGradient gradient( QskGradient::Vertical, color1, color2 );
|
||||
setGradient( aspect, gradient, combinationMask );
|
||||
setGradient( aspect, gradient, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setGradient(
|
||||
QskAspect aspect, const QskGradient& gradient,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspect, gradient, combinationMask );
|
||||
setColorHint( aspect, gradient, combination );
|
||||
}
|
||||
|
||||
QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const
|
||||
@ -227,22 +233,22 @@ QskGradient QskSkinHintTableEditor::gradient( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setStrutSize(
|
||||
QskAspect aspect, const QSizeF& size, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QSizeF& size, QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectStrutSize( aspect ), size, combinationMask );
|
||||
setMetricHint( aspectStrutSize( aspect ), size, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setStrutSize(
|
||||
QskAspect aspect, qreal width, qreal height, QskAspect::State combinationMask )
|
||||
QskAspect aspect, qreal width, qreal height, QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectStrutSize( aspect ),
|
||||
QSizeF( width, height ), combinationMask );
|
||||
QSizeF( width, height ), combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeStrutSize(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeMetricHint( aspectStrutSize( aspect ), combinationMask );
|
||||
removeMetricHint( aspectStrutSize( aspect ), combination );
|
||||
}
|
||||
|
||||
QSizeF QskSkinHintTableEditor::strutSize( QskAspect aspect ) const
|
||||
@ -251,23 +257,23 @@ QSizeF QskSkinHintTableEditor::strutSize( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMargin(
|
||||
QskAspect aspect, const QskMargins& margins, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QskMargins& margins, QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectMargin( aspect ), margins, combinationMask );
|
||||
setMetricHint( aspectMargin( aspect ), margins, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setMargin( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
const QskMargins margins( left, top, right, bottom );
|
||||
setMetricHint( aspectMargin( aspect ), margins, combinationMask );
|
||||
setMetricHint( aspectMargin( aspect ), margins, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeMargin(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeMetricHint( aspectMargin( aspect ), combinationMask );
|
||||
removeMetricHint( aspectMargin( aspect ), combination );
|
||||
}
|
||||
|
||||
QskMargins QskSkinHintTableEditor::margin( QskAspect aspect ) const
|
||||
@ -277,23 +283,23 @@ QskMargins QskSkinHintTableEditor::margin( QskAspect aspect ) const
|
||||
|
||||
void QskSkinHintTableEditor::setPadding(
|
||||
QskAspect aspect, const QskMargins& padding,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectPadding( aspect ), padding, combinationMask );
|
||||
setMetricHint( aspectPadding( aspect ), padding, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setPadding( QskAspect aspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
QskMargins padding( left, top, right, bottom );
|
||||
setMetricHint( aspectPadding( aspect ), padding, combinationMask );
|
||||
setMetricHint( aspectPadding( aspect ), padding, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removePadding(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeMetricHint( aspectPadding( aspect ), combinationMask );
|
||||
removeMetricHint( aspectPadding( aspect ), combination );
|
||||
}
|
||||
|
||||
QskMargins QskSkinHintTableEditor::padding( QskAspect aspect ) const
|
||||
@ -302,15 +308,15 @@ QskMargins QskSkinHintTableEditor::padding( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setSpacing(
|
||||
QskAspect aspect, qreal spacing, QskAspect::State combinationMask )
|
||||
QskAspect aspect, qreal spacing, QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectSpacing( aspect ), spacing, combinationMask );
|
||||
setMetricHint( aspectSpacing( aspect ), spacing, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeSpacing(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeMetricHint( aspectSpacing( aspect ), combinationMask );
|
||||
removeMetricHint( aspectSpacing( aspect ), combination );
|
||||
}
|
||||
|
||||
qreal QskSkinHintTableEditor::spacing( QskAspect aspect ) const
|
||||
@ -319,16 +325,16 @@ qreal QskSkinHintTableEditor::spacing( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setAlignment(
|
||||
QskAspect aspect, Qt::Alignment alignment, QskAspect::State combinationMask )
|
||||
QskAspect aspect, Qt::Alignment alignment, QskStateCombination combination )
|
||||
{
|
||||
setFlagHint( aspectAlignment( aspect ),
|
||||
static_cast< int >( alignment ), combinationMask );
|
||||
static_cast< int >( alignment ), combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeAlignment(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeFlagHint( aspectAlignment( aspect ), combinationMask );
|
||||
return removeFlagHint( aspectAlignment( aspect ), combination );
|
||||
}
|
||||
|
||||
Qt::Alignment QskSkinHintTableEditor::alignment( QskAspect aspect ) const
|
||||
@ -337,15 +343,15 @@ Qt::Alignment QskSkinHintTableEditor::alignment( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setFontRole(
|
||||
QskAspect aspect, int fontRole, QskAspect::State combinationMask )
|
||||
QskAspect aspect, int fontRole, QskStateCombination combination )
|
||||
{
|
||||
setFlagHint( aspectFontRole( aspect ), fontRole, combinationMask );
|
||||
setFlagHint( aspectFontRole( aspect ), fontRole, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeFontRole(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeFlagHint( aspectFontRole( aspect ), combinationMask );
|
||||
return removeFlagHint( aspectFontRole( aspect ), combination );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::fontRole( QskAspect aspect ) const
|
||||
@ -354,15 +360,15 @@ int QskSkinHintTableEditor::fontRole( QskAspect aspect ) const
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setGraphicRole(
|
||||
QskAspect aspect, int graphicRole, QskAspect::State combinationMask )
|
||||
QskAspect aspect, int graphicRole, QskStateCombination combination )
|
||||
{
|
||||
setFlagHint( aspectGraphicRole( aspect ), graphicRole, combinationMask );
|
||||
setFlagHint( aspectGraphicRole( aspect ), graphicRole, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeGraphicRole(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeFlagHint( aspectGraphicRole( aspect ), combinationMask );
|
||||
return removeFlagHint( aspectGraphicRole( aspect ), combination );
|
||||
}
|
||||
|
||||
int QskSkinHintTableEditor::graphicRole( QskAspect aspect ) const
|
||||
@ -386,15 +392,16 @@ void QskSkinHintTableEditor::setBoxShape( QskAspect aspect,
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxShape(
|
||||
QskAspect aspect, const QskBoxShapeMetrics& shape, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QskBoxShapeMetrics& shape,
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectShape( aspect ), shape, combinationMask );
|
||||
setMetricHint( aspectShape( aspect ), shape, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxShape(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeMetricHint( aspectShape( aspect ), combinationMask );
|
||||
return removeMetricHint( aspectShape( aspect ), combination );
|
||||
}
|
||||
|
||||
QskBoxShapeMetrics QskSkinHintTableEditor::boxShape( QskAspect aspect ) const
|
||||
@ -418,15 +425,15 @@ void QskSkinHintTableEditor::setBoxBorderMetrics( QskAspect aspect,
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderMetrics(
|
||||
QskAspect aspect, const QskBoxBorderMetrics& borderMetrics,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setMetricHint( aspectBorder( aspect ), borderMetrics, combinationMask );
|
||||
setMetricHint( aspectBorder( aspect ), borderMetrics, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxBorderMetric(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeMetricHint( aspectBorder( aspect ), combinationMask );
|
||||
return removeMetricHint( aspectBorder( aspect ), combination );
|
||||
}
|
||||
|
||||
QskBoxBorderMetrics QskSkinHintTableEditor::boxBorderMetrics( QskAspect aspect ) const
|
||||
@ -436,24 +443,24 @@ QskBoxBorderMetrics QskSkinHintTableEditor::boxBorderMetrics( QskAspect aspect )
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderColors(
|
||||
QskAspect aspect, const QskBoxBorderColors& borderColors,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspectBorder( aspect ), borderColors, combinationMask );
|
||||
setColorHint( aspectBorder( aspect ), borderColors, combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::setBoxBorderColors( QskAspect aspect,
|
||||
const QColor& left, const QColor& top, const QColor& right, const QColor& bottom,
|
||||
QskAspect::State combinationMask )
|
||||
QskStateCombination combination )
|
||||
{
|
||||
setColorHint( aspectBorder( aspect ),
|
||||
QskBoxBorderColors( left, top, right, bottom ),
|
||||
combinationMask );
|
||||
combination );
|
||||
}
|
||||
|
||||
void QskSkinHintTableEditor::removeBoxBorderColors(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
return removeColorHint( aspectBorder( aspect ), combinationMask );
|
||||
return removeColorHint( aspectBorder( aspect ), combination );
|
||||
}
|
||||
|
||||
QskBoxBorderColors QskSkinHintTableEditor::boxBorderColors( QskAspect aspect ) const
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "QskAspect.h"
|
||||
#include "QskSkinHintTable.h"
|
||||
#include "QskAnimationHint.h"
|
||||
#include "QskStateCombination.h"
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qvariant.h>
|
||||
@ -30,15 +31,15 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
// generic access
|
||||
|
||||
void setHint( QskAspect, const QVariant&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
template< typename T > void setHint(
|
||||
QskAspect, const T&, QskAspect::State = QskAspect::NoState );
|
||||
QskAspect, const T&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
const QVariant& hint( QskAspect ) const;
|
||||
template< typename T > T hint( QskAspect ) const;
|
||||
|
||||
bool removeHint( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
bool removeHint( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
QVariant takeHint( QskAspect );
|
||||
|
||||
bool hasHint( QskAspect ) const;
|
||||
@ -46,19 +47,19 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
// animation hints
|
||||
|
||||
void setAnimation( QskAspect, QskAnimationHint,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskAnimationHint animation( QskAspect ) const;
|
||||
|
||||
// flag
|
||||
|
||||
void setFlagHint( QskAspect, const QVariant&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
template< typename T > void setFlagHint( QskAspect, const T&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeFlagHint( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeFlagHint( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QVariant flagHint( QskAspect ) const;
|
||||
template< typename T > T flagHint( QskAspect ) const;
|
||||
@ -66,12 +67,12 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
// metric
|
||||
|
||||
void setMetricHint( QskAspect, const QVariant&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
template< typename T > void setMetricHint(
|
||||
QskAspect, const T&, QskAspect::State = QskAspect::NoState );
|
||||
QskAspect, const T&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeMetricHint( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeMetricHint( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QVariant metricHint( QskAspect ) const;
|
||||
template< typename T > T metricHint( QskAspect ) const;
|
||||
@ -79,103 +80,103 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
// color
|
||||
|
||||
void setColorHint( QskAspect, const QVariant&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
template< typename T > void setColorHint(
|
||||
QskAspect, const T&, QskAspect::State = QskAspect::NoState );
|
||||
QskAspect, const T&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeColorHint( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeColorHint( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QVariant colorHint( QskAspect ) const;
|
||||
template< typename T > T colorHint( QskAspect ) const;
|
||||
|
||||
// type specific
|
||||
|
||||
void setFlag( QskAspect, int, QskAspect::State = QskAspect::NoState );
|
||||
void setFlag( QskAspect, int, QskStateCombination = QskStateCombination() );
|
||||
int flag( QskAspect ) const;
|
||||
|
||||
void setMetric( QskAspect, qreal metric, QskAspect::State = QskAspect::NoState );
|
||||
void setMetric( QskAspect, qreal metric, QskStateCombination = QskStateCombination() );
|
||||
qreal metric( QskAspect ) const;
|
||||
|
||||
void setColor( QskAspect, Qt::GlobalColor, QskAspect::State = QskAspect::NoState );
|
||||
void setColor( QskAspect, QRgb, QskAspect::State = QskAspect::NoState );
|
||||
void setColor( QskAspect, const QColor&, QskAspect::State = QskAspect::NoState );
|
||||
void setColor( QskAspect, Qt::GlobalColor, QskStateCombination = QskStateCombination() );
|
||||
void setColor( QskAspect, QRgb, QskStateCombination = QskStateCombination() );
|
||||
void setColor( QskAspect, const QColor&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QColor color( QskAspect ) const;
|
||||
|
||||
// gradients
|
||||
|
||||
void setHGradient( QskAspect, const QColor&, const QColor&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setVGradient( QskAspect, const QColor&, const QColor&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setGradient( QskAspect, const QskGradient&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskGradient gradient( QskAspect ) const;
|
||||
|
||||
// strutSize
|
||||
|
||||
void setStrutSize( QskAspect, const QSizeF&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setStrutSize( QskAspect, qreal width, qreal height,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeStrutSize( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeStrutSize( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QSizeF strutSize( QskAspect ) const;
|
||||
|
||||
// margin
|
||||
|
||||
void setMargin( QskAspect, const QskMargins&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setMargin( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeMargin( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeMargin( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskMargins margin( QskAspect ) const;
|
||||
|
||||
// padding
|
||||
|
||||
void setPadding( QskAspect, const QskMargins&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setPadding( QskAspect,
|
||||
qreal left, qreal top, qreal right, qreal bottom,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removePadding( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removePadding( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskMargins padding( QskAspect ) const;
|
||||
|
||||
// spacing
|
||||
|
||||
void setSpacing( QskAspect, qreal, QskAspect::State = QskAspect::NoState );
|
||||
void removeSpacing( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void setSpacing( QskAspect, qreal, QskStateCombination = QskStateCombination() );
|
||||
void removeSpacing( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
qreal spacing( QskAspect ) const;
|
||||
|
||||
// alignment
|
||||
|
||||
void setAlignment( QskAspect, Qt::Alignment, QskAspect::State = QskAspect::NoState );
|
||||
void removeAlignment( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void setAlignment( QskAspect, Qt::Alignment, QskStateCombination = QskStateCombination() );
|
||||
void removeAlignment( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
Qt::Alignment alignment( QskAspect ) const;
|
||||
|
||||
// fontRole
|
||||
|
||||
void setFontRole( QskAspect, int, QskAspect::State = QskAspect::NoState );
|
||||
void removeFontRole( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void setFontRole( QskAspect, int, QskStateCombination = QskStateCombination() );
|
||||
void removeFontRole( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
int fontRole( QskAspect ) const;
|
||||
|
||||
// graphicRole
|
||||
|
||||
void setGraphicRole( QskAspect, int, QskAspect::State = QskAspect::NoState );
|
||||
void removeGraphicRole( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void setGraphicRole( QskAspect, int, QskStateCombination = QskStateCombination() );
|
||||
void removeGraphicRole( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
int graphicRole( QskAspect ) const;
|
||||
|
||||
// boxShape
|
||||
@ -186,9 +187,9 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
qreal bottomLeft, qreal bottomRight, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxShape( QskAspect, const QskBoxShapeMetrics&,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeBoxShape( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeBoxShape( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskBoxShapeMetrics boxShape( QskAspect ) const;
|
||||
|
||||
@ -201,22 +202,22 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
qreal right, qreal bottom, Qt::SizeMode = Qt::AbsoluteSize );
|
||||
|
||||
void setBoxBorderMetrics( QskAspect,
|
||||
const QskBoxBorderMetrics&, QskAspect::State = QskAspect::NoState );
|
||||
const QskBoxBorderMetrics&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeBoxBorderMetric( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeBoxBorderMetric( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
|
||||
QskBoxBorderMetrics boxBorderMetrics( QskAspect ) const;
|
||||
|
||||
// boxBorderColors
|
||||
|
||||
void setBoxBorderColors( QskAspect,
|
||||
const QskBoxBorderColors&, QskAspect::State = QskAspect::NoState );
|
||||
const QskBoxBorderColors&, QskStateCombination = QskStateCombination() );
|
||||
|
||||
void setBoxBorderColors( QskAspect,
|
||||
const QColor& left, const QColor& top, const QColor& right, const QColor& bottom,
|
||||
QskAspect::State = QskAspect::NoState );
|
||||
QskStateCombination = QskStateCombination() );
|
||||
|
||||
void removeBoxBorderColors( QskAspect, QskAspect::State = QskAspect::NoState );
|
||||
void removeBoxBorderColors( QskAspect, QskStateCombination = QskStateCombination() );
|
||||
QskBoxBorderColors boxBorderColors( QskAspect ) const;
|
||||
|
||||
private:
|
||||
@ -227,9 +228,9 @@ class QSK_EXPORT QskSkinHintTableEditor
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setHint(
|
||||
QskAspect aspect, const T& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const T& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect, QVariant::fromValue( hint ), combinationMask );
|
||||
setHint( aspect, QVariant::fromValue( hint ), combination );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
@ -256,22 +257,22 @@ inline bool QskSkinHintTableEditor::hasHint( QskAspect aspect ) const
|
||||
// --- flag ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setFlagHint(
|
||||
QskAspect aspect, const QVariant& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QVariant& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Flag, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Flag, hint, combination );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setFlagHint(
|
||||
QskAspect aspect, const T& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const T& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Flag, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Flag, hint, combination );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeFlagHint(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Flag, combinationMask );
|
||||
removeHint( aspect | QskAspect::Flag, combination );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::flagHint( QskAspect aspect ) const
|
||||
@ -288,22 +289,22 @@ inline T QskSkinHintTableEditor::flagHint( QskAspect aspect ) const
|
||||
// --- metric ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setMetricHint(
|
||||
QskAspect aspect, const QVariant& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QVariant& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Metric, hint, combination );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setMetricHint(
|
||||
QskAspect aspect, const T& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const T& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Metric, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Metric, hint, combination );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeMetricHint(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Metric, combinationMask );
|
||||
removeHint( aspect | QskAspect::Metric, combination );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::metricHint( QskAspect aspect ) const
|
||||
@ -320,22 +321,22 @@ inline T QskSkinHintTableEditor::metricHint( QskAspect aspect ) const
|
||||
// --- color ---
|
||||
|
||||
inline void QskSkinHintTableEditor::setColorHint(
|
||||
QskAspect aspect, const QVariant& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const QVariant& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Color, hint, combination );
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
inline void QskSkinHintTableEditor::setColorHint(
|
||||
QskAspect aspect, const T& hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, const T& hint, QskStateCombination combination )
|
||||
{
|
||||
setHint( aspect | QskAspect::Color, hint, combinationMask );
|
||||
setHint( aspect | QskAspect::Color, hint, combination );
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::removeColorHint(
|
||||
QskAspect aspect, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskStateCombination combination )
|
||||
{
|
||||
removeHint( aspect | QskAspect::Color, combinationMask );
|
||||
removeHint( aspect | QskAspect::Color, combination );
|
||||
}
|
||||
|
||||
inline QVariant QskSkinHintTableEditor::colorHint( QskAspect aspect ) const
|
||||
@ -357,10 +358,10 @@ inline QskAnimationHint QskSkinHintTableEditor::animation( QskAspect aspect ) co
|
||||
}
|
||||
|
||||
inline void QskSkinHintTableEditor::setAnimation(
|
||||
QskAspect aspect, QskAnimationHint hint, QskAspect::State combinationMask )
|
||||
QskAspect aspect, QskAnimationHint hint, QskStateCombination combination )
|
||||
{
|
||||
aspect.setAnimator( true );
|
||||
setHint( aspect, hint, combinationMask );
|
||||
setHint( aspect, hint, combination );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -344,7 +344,7 @@ namespace
|
||||
}
|
||||
|
||||
auto a = candidate.aspect;
|
||||
a.setState( control->skinState() );
|
||||
a.setStates( control->skinStates() );
|
||||
|
||||
const auto requestState = control->hintStatus( a );
|
||||
|
||||
|
@ -187,14 +187,14 @@ static inline void qskTriggerUpdates( QskAspect aspect, QskControl* control )
|
||||
static inline QskAspect qskSubstitutedAspect(
|
||||
const QskSkinnable* skinnable, QskAspect aspect )
|
||||
{
|
||||
if ( aspect.hasState() )
|
||||
if ( aspect.hasStates() )
|
||||
{
|
||||
qWarning() << "QskSkinnable::(re)setSkinHint: setting hints with states "
|
||||
"is discouraged - use QskSkinTableEditor if you are "
|
||||
"sure, that you need this.";
|
||||
|
||||
qWarning() << "QskAspect:" << aspect.stateless()
|
||||
<< skinnable->skinStateAsPrintable( aspect.state() );
|
||||
<< skinnable->skinStatesAsPrintable( aspect.states() );
|
||||
|
||||
#if 0
|
||||
aspect.clearStates();
|
||||
@ -227,7 +227,7 @@ class QskSkinnable::PrivateData
|
||||
|
||||
const QskSkinlet* skinlet = nullptr;
|
||||
|
||||
QskAspect::State skinState = QskAspect::NoState;
|
||||
QskAspect::States skinStates = QskAspect::NoState;
|
||||
bool hasLocalSkinlet = false;
|
||||
};
|
||||
|
||||
@ -582,7 +582,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter( QskAspect aspect ) const
|
||||
|
||||
QskSkinHintStatus status;
|
||||
|
||||
const auto hint = storedHint( aspect | skinState(), &status );
|
||||
const auto hint = storedHint( aspect | skinStates(), &status );
|
||||
if ( status.isValid() )
|
||||
{
|
||||
// we need to know about how the aspect gets resolved
|
||||
@ -634,14 +634,14 @@ QskAnimationHint QskSkinnable::animationHint(
|
||||
|
||||
QskAnimationHint QskSkinnable::effectiveAnimation(
|
||||
QskAspect::Type type, QskAspect::Subcontrol subControl,
|
||||
QskAspect::State state, QskSkinHintStatus* status ) const
|
||||
QskAspect::States states, QskSkinHintStatus* status ) const
|
||||
{
|
||||
#if 0
|
||||
// TODO ...
|
||||
subControl = effectiveSubcontrol( aspect.subControl() );
|
||||
#endif
|
||||
|
||||
auto aspect = subControl | type | state;
|
||||
auto aspect = subControl | type | states;
|
||||
aspect.setAnimator( true );
|
||||
|
||||
QskAnimationHint hint;
|
||||
@ -721,8 +721,8 @@ QVariant QskSkinnable::effectiveSkinHint(
|
||||
if ( v.isValid() )
|
||||
return v;
|
||||
|
||||
if ( !aspect.hasState() )
|
||||
aspect.setState( skinState() );
|
||||
if ( !aspect.hasStates() )
|
||||
aspect.setStates( skinStates() );
|
||||
|
||||
return storedHint( aspect, status );
|
||||
}
|
||||
@ -741,7 +741,7 @@ QVariant QskSkinnable::animatedValue(
|
||||
{
|
||||
QVariant v;
|
||||
|
||||
if ( !aspect.hasState() )
|
||||
if ( !aspect.hasStates() )
|
||||
{
|
||||
/*
|
||||
The local animators were invented to be stateless
|
||||
@ -765,8 +765,8 @@ QVariant QskSkinnable::animatedValue(
|
||||
|
||||
if ( const auto control = owningControl() )
|
||||
{
|
||||
if ( aspect.state() == QskAspect::NoState )
|
||||
aspect = aspect | skinState();
|
||||
if ( !aspect.hasStates() )
|
||||
aspect.setStates( skinStates() );
|
||||
|
||||
const auto a = aspect;
|
||||
|
||||
@ -813,7 +813,7 @@ const QVariant& QskSkinnable::storedHint(
|
||||
const auto skin = effectiveSkin();
|
||||
|
||||
// clearing all state bits not being handled from the skin
|
||||
aspect.clearState( ~skin->stateMask() );
|
||||
aspect.clearStates( ~skin->stateMask() );
|
||||
|
||||
QskAspect resolvedAspect;
|
||||
|
||||
@ -891,25 +891,25 @@ const QVariant& QskSkinnable::storedHint(
|
||||
|
||||
bool QskSkinnable::hasSkinState( QskAspect::State state ) const
|
||||
{
|
||||
return ( m_data->skinState & state ) == state;
|
||||
return ( m_data->skinStates & state ) == state;
|
||||
}
|
||||
|
||||
QskAspect::State QskSkinnable::skinState() const
|
||||
QskAspect::States QskSkinnable::skinStates() const
|
||||
{
|
||||
return m_data->skinState;
|
||||
return m_data->skinStates;
|
||||
}
|
||||
|
||||
const char* QskSkinnable::skinStateAsPrintable() const
|
||||
const char* QskSkinnable::skinStatesAsPrintable() const
|
||||
{
|
||||
return skinStateAsPrintable( skinState() );
|
||||
return skinStatesAsPrintable( skinStates() );
|
||||
}
|
||||
|
||||
const char* QskSkinnable::skinStateAsPrintable( QskAspect::State state ) const
|
||||
const char* QskSkinnable::skinStatesAsPrintable( QskAspect::States states ) const
|
||||
{
|
||||
QString tmp;
|
||||
|
||||
QDebug debug( &tmp );
|
||||
qskDebugState( debug, metaObject(), state );
|
||||
qskDebugStates( debug, metaObject(), states );
|
||||
|
||||
// we should find a better way
|
||||
static QByteArray bytes[ 10 ];
|
||||
@ -1088,20 +1088,20 @@ void QskSkinnable::startHintTransition( QskAspect aspect,
|
||||
void QskSkinnable::setSkinStateFlag( QskAspect::State stateFlag, bool on )
|
||||
{
|
||||
const auto newState = on
|
||||
? ( m_data->skinState | stateFlag )
|
||||
: ( m_data->skinState & ~stateFlag );
|
||||
? ( m_data->skinStates | stateFlag )
|
||||
: ( m_data->skinStates & ~stateFlag );
|
||||
|
||||
setSkinState( newState, true );
|
||||
setSkinStates( newState, true );
|
||||
}
|
||||
|
||||
void QskSkinnable::replaceSkinState( QskAspect::State newState )
|
||||
void QskSkinnable::replaceSkinStates( QskAspect::States newStates )
|
||||
{
|
||||
m_data->skinState = newState;
|
||||
m_data->skinStates = newStates;
|
||||
}
|
||||
|
||||
void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
void QskSkinnable::setSkinStates( QskAspect::States newStates, bool animated )
|
||||
{
|
||||
if ( m_data->skinState == newState )
|
||||
if ( m_data->skinStates == newStates )
|
||||
return;
|
||||
|
||||
auto control = owningControl();
|
||||
@ -1117,11 +1117,11 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
if ( skin )
|
||||
{
|
||||
const auto mask = skin->stateMask();
|
||||
if ( ( newState & mask ) == ( m_data->skinState & mask ) )
|
||||
if ( ( newStates & mask ) == ( m_data->skinStates & mask ) )
|
||||
{
|
||||
// the modified bits are not handled by the skin
|
||||
|
||||
m_data->skinState = newState;
|
||||
m_data->skinStates = newStates;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1142,7 +1142,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
{
|
||||
const auto type = static_cast< QskAspect::Type >( i );
|
||||
|
||||
const auto hint = effectiveAnimation( type, subControl, newState );
|
||||
const auto hint = effectiveAnimation( type, subControl, newStates );
|
||||
|
||||
if ( hint.duration > 0 )
|
||||
{
|
||||
@ -1156,8 +1156,8 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
const auto primitive = static_cast< QskAspect::Primitive >( i );
|
||||
aspect.setPrimitive( type, primitive );
|
||||
|
||||
auto a1 = aspect | m_data->skinState;
|
||||
auto a2 = aspect | newState;
|
||||
auto a1 = aspect | m_data->skinStates;
|
||||
auto a2 = aspect | newStates;
|
||||
|
||||
bool doTransition = true;
|
||||
|
||||
@ -1186,7 +1186,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
||||
}
|
||||
}
|
||||
|
||||
m_data->skinState = newState;
|
||||
m_data->skinStates = newStates;
|
||||
|
||||
if ( control->flags() & QQuickItem::ItemHasContents )
|
||||
control->update();
|
||||
@ -1262,7 +1262,7 @@ void QskSkinnable::debug( QDebug debug, QskAspect aspect ) const
|
||||
|
||||
void QskSkinnable::debug( QDebug debug, QskAspect::State state ) const
|
||||
{
|
||||
qskDebugState( debug, metaObject(), state );
|
||||
qskDebugStates( debug, metaObject(), state );
|
||||
}
|
||||
|
||||
void QskSkinnable::debug( QskAspect aspect ) const
|
||||
@ -1272,7 +1272,7 @@ void QskSkinnable::debug( QskAspect aspect ) const
|
||||
|
||||
void QskSkinnable::debug( QskAspect::State state ) const
|
||||
{
|
||||
qskDebugState( qDebug(), metaObject(), state );
|
||||
qskDebugStates( qDebug(), metaObject(), state );
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -90,7 +90,7 @@ class QSK_EXPORT QskSkinnable
|
||||
bool resetSkinHint( QskAspect );
|
||||
|
||||
QskAnimationHint effectiveAnimation( QskAspect::Type, QskAspect::Subcontrol,
|
||||
QskAspect::State, QskSkinHintStatus* status = nullptr ) const;
|
||||
QskAspect::States, QskSkinHintStatus* status = nullptr ) const;
|
||||
|
||||
QVariant effectiveSkinHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||
virtual QskAspect::Placement effectivePlacement() const;
|
||||
@ -127,16 +127,16 @@ class QSK_EXPORT QskSkinnable
|
||||
void debug( QDebug, QskAspect ) const;
|
||||
void debug( QDebug, QskAspect::State ) const;
|
||||
|
||||
void setSkinState( QskAspect::State, bool animated = true );
|
||||
void setSkinStates( QskAspect::States, bool animated = true );
|
||||
void setSkinStateFlag( QskAspect::State, bool on = true );
|
||||
|
||||
void replaceSkinState( QskAspect::State );
|
||||
void replaceSkinStates( QskAspect::States );
|
||||
|
||||
bool hasSkinState( QskAspect::State ) const;
|
||||
QskAspect::State skinState() const;
|
||||
QskAspect::States skinStates() const;
|
||||
|
||||
const char* skinStateAsPrintable() const;
|
||||
const char* skinStateAsPrintable( QskAspect::State ) const;
|
||||
const char* skinStatesAsPrintable() const;
|
||||
const char* skinStatesAsPrintable( QskAspect::States ) const;
|
||||
|
||||
// type aware methods for accessing skin hints
|
||||
|
||||
|
@ -227,7 +227,7 @@ qreal QskSlider::handlePosition() const
|
||||
void QskSlider::moveHandle()
|
||||
{
|
||||
const auto aspect = Handle | QskAspect::Metric | QskAspect::Position;
|
||||
moveHandleTo( value(), animationHint( aspect | skinState() ) );
|
||||
moveHandleTo( value(), animationHint( aspect | skinStates() ) );
|
||||
}
|
||||
|
||||
void QskSlider::moveHandleTo( qreal value, const QskAnimationHint& hint )
|
||||
|
@ -17,7 +17,6 @@ HEADERS += \
|
||||
common/QskBoxBorderMetrics.h \
|
||||
common/QskBoxShapeMetrics.h \
|
||||
common/QskCorner.h \
|
||||
common/QskFlags.h \
|
||||
common/QskFunctions.h \
|
||||
common/QskGlobal.h \
|
||||
common/QskGradient.h \
|
||||
@ -34,6 +33,7 @@ HEADERS += \
|
||||
common/QskScaleTickmarks.h \
|
||||
common/QskShadowMetrics.h \
|
||||
common/QskSizePolicy.h \
|
||||
common/QskStateCombination.h \
|
||||
common/QskTextColors.h \
|
||||
common/QskTextOptions.h
|
||||
|
||||
@ -56,6 +56,7 @@ SOURCES += \
|
||||
common/QskScaleTickmarks.cpp \
|
||||
common/QskShadowMetrics.cpp \
|
||||
common/QskSizePolicy.cpp \
|
||||
common/QskStateCombination.cpp \
|
||||
common/QskTextColors.cpp \
|
||||
common/QskTextOptions.cpp
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user