QskAspect::Control renamed to QskAspect::NoSubcontrol
This commit is contained in:
parent
19f01c0232
commit
c5ace32bf2
|
@ -211,10 +211,10 @@ void Editor::setupControl()
|
||||||
{
|
{
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
|
|
||||||
setPadding( A::Control, 11_dp );
|
setPadding( A::NoSubcontrol, 11_dp );
|
||||||
|
|
||||||
setGradient( A::Control, m_pal.background );
|
setGradient( A::NoSubcontrol, m_pal.background );
|
||||||
setColor( A::Control | A::StyleColor, m_pal.onBackground );
|
setColor( A::NoSubcontrol | A::StyleColor, m_pal.onBackground );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupCheckBox()
|
void Editor::setupCheckBox()
|
||||||
|
|
|
@ -277,11 +277,11 @@ void Editor::setupControl()
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
using Q = QskControl;
|
using Q = QskControl;
|
||||||
|
|
||||||
setPadding( A::Control, 4 );
|
setPadding( A::NoSubcontrol, 4 );
|
||||||
|
|
||||||
setGradient( A::Control, m_pal.lighter135 );
|
setGradient( A::NoSubcontrol, m_pal.lighter135 );
|
||||||
setColor( A::Control | A::StyleColor, m_pal.themeForeground );
|
setColor( A::NoSubcontrol | A::StyleColor, m_pal.themeForeground );
|
||||||
setColor( A::Control | A::StyleColor | Q::Disabled, m_pal.theme );
|
setColor( A::NoSubcontrol | A::StyleColor | Q::Disabled, m_pal.theme );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupBox()
|
void Editor::setupBox()
|
||||||
|
|
|
@ -85,7 +85,7 @@ class QSK_EXPORT QskAspect
|
||||||
|
|
||||||
enum Subcontrol : quint16
|
enum Subcontrol : quint16
|
||||||
{
|
{
|
||||||
Control = 0,
|
NoSubcontrol = 0,
|
||||||
LastSubcontrol = ( 1 << 12 ) - 1
|
LastSubcontrol = ( 1 << 12 ) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,7 +150,9 @@ class QSK_EXPORT QskAspect
|
||||||
void setAnimator( bool on ) noexcept;
|
void setAnimator( bool on ) noexcept;
|
||||||
|
|
||||||
constexpr Subcontrol subControl() const noexcept;
|
constexpr Subcontrol subControl() const noexcept;
|
||||||
void setSubControl( Subcontrol ) noexcept;
|
void setSubcontrol( Subcontrol ) noexcept;
|
||||||
|
constexpr bool hasSubcontrol() const noexcept;
|
||||||
|
void clearSubcontrol() noexcept;
|
||||||
|
|
||||||
constexpr Section section() const noexcept;
|
constexpr Section section() const noexcept;
|
||||||
void setSection( Section ) noexcept;
|
void setSection( Section ) noexcept;
|
||||||
|
@ -241,7 +243,7 @@ constexpr inline QskAspect::State operator>>( QskAspect::State a, const int b )
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskAspect::QskAspect() noexcept
|
inline constexpr QskAspect::QskAspect() noexcept
|
||||||
: QskAspect( Control, Body, Flag, NoPlacement )
|
: QskAspect( NoSubcontrol, Body, Flag, NoPlacement )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,17 +253,17 @@ inline constexpr QskAspect::QskAspect( Subcontrol subControl ) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskAspect::QskAspect( Section section ) noexcept
|
inline constexpr QskAspect::QskAspect( Section section ) noexcept
|
||||||
: QskAspect( Control, section, Flag, NoPlacement )
|
: QskAspect( NoSubcontrol, section, Flag, NoPlacement )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskAspect::QskAspect( Type type ) noexcept
|
inline constexpr QskAspect::QskAspect( Type type ) noexcept
|
||||||
: QskAspect( Control, Body, type, NoPlacement )
|
: QskAspect( NoSubcontrol, Body, type, NoPlacement )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskAspect::QskAspect( Placement placement ) noexcept
|
inline constexpr QskAspect::QskAspect( Placement placement ) noexcept
|
||||||
: QskAspect( Control, Body, Flag, placement )
|
: QskAspect( NoSubcontrol, Body, Flag, placement )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,11 +404,21 @@ inline constexpr QskAspect::Subcontrol QskAspect::subControl() const noexcept
|
||||||
return static_cast< Subcontrol >( m_bits.subControl );
|
return static_cast< Subcontrol >( m_bits.subControl );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskAspect::setSubControl( Subcontrol subControl ) noexcept
|
inline void QskAspect::setSubcontrol( Subcontrol subControl ) noexcept
|
||||||
{
|
{
|
||||||
m_bits.subControl = subControl;
|
m_bits.subControl = subControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline constexpr bool QskAspect::hasSubcontrol() const noexcept
|
||||||
|
{
|
||||||
|
return m_bits.subControl != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskAspect::clearSubcontrol() noexcept
|
||||||
|
{
|
||||||
|
m_bits.subControl = 0;
|
||||||
|
}
|
||||||
|
|
||||||
inline constexpr QskAspect::Section QskAspect::section() const noexcept
|
inline constexpr QskAspect::Section QskAspect::section() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Section >( m_bits.section );
|
return static_cast< Section >( m_bits.section );
|
||||||
|
|
|
@ -145,19 +145,19 @@ void QskControl::setBackgroundColor( const QColor& color )
|
||||||
|
|
||||||
void QskControl::setBackground( const QskGradient& gradient )
|
void QskControl::setBackground( const QskGradient& gradient )
|
||||||
{
|
{
|
||||||
if ( setGradientHint( QskAspect::Control, gradient ) )
|
if ( setGradientHint( QskAspect::NoSubcontrol, gradient ) )
|
||||||
Q_EMIT backgroundChanged();
|
Q_EMIT backgroundChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskControl::resetBackground()
|
void QskControl::resetBackground()
|
||||||
{
|
{
|
||||||
if ( resetColor( QskAspect::Control ) )
|
if ( resetColor( QskAspect::NoSubcontrol ) )
|
||||||
Q_EMIT backgroundChanged();
|
Q_EMIT backgroundChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskGradient QskControl::background() const
|
QskGradient QskControl::background() const
|
||||||
{
|
{
|
||||||
return gradientHint( QskAspect::Control );
|
return gradientHint( QskAspect::NoSubcontrol );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskControl::setMargins( qreal margin )
|
void QskControl::setMargins( qreal margin )
|
||||||
|
@ -174,7 +174,7 @@ void QskControl::setMargins( const QMarginsF& margins )
|
||||||
{
|
{
|
||||||
const auto m = QskMargins().expandedTo( margins );
|
const auto m = QskMargins().expandedTo( margins );
|
||||||
|
|
||||||
if ( setMarginHint( QskAspect::Control, m ) )
|
if ( setMarginHint( QskAspect::NoSubcontrol, m ) )
|
||||||
{
|
{
|
||||||
qskSendEventTo( this, QEvent::ContentsRectChange );
|
qskSendEventTo( this, QEvent::ContentsRectChange );
|
||||||
Q_EMIT marginsChanged( m );
|
Q_EMIT marginsChanged( m );
|
||||||
|
@ -183,7 +183,7 @@ void QskControl::setMargins( const QMarginsF& margins )
|
||||||
|
|
||||||
void QskControl::resetMargins()
|
void QskControl::resetMargins()
|
||||||
{
|
{
|
||||||
if ( resetMarginHint( QskAspect::Control ) )
|
if ( resetMarginHint( QskAspect::NoSubcontrol ) )
|
||||||
{
|
{
|
||||||
qskSendEventTo( this, QEvent::ContentsRectChange );
|
qskSendEventTo( this, QEvent::ContentsRectChange );
|
||||||
Q_EMIT marginsChanged( margins() );
|
Q_EMIT marginsChanged( margins() );
|
||||||
|
@ -192,7 +192,7 @@ void QskControl::resetMargins()
|
||||||
|
|
||||||
QMarginsF QskControl::margins() const
|
QMarginsF QskControl::margins() const
|
||||||
{
|
{
|
||||||
return marginHint( QskAspect::Control );
|
return marginHint( QskAspect::NoSubcontrol );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskControl::contentsRect() const
|
QRectF QskControl::contentsRect() const
|
||||||
|
|
|
@ -177,7 +177,7 @@ QskSkin::QskSkin( QObject* parent )
|
||||||
{
|
{
|
||||||
// some defaults
|
// some defaults
|
||||||
const auto noMargins = QVariant::fromValue( QskMargins( 0 ) );
|
const auto noMargins = QVariant::fromValue( QskMargins( 0 ) );
|
||||||
const auto aspect = QskAspect::Control | QskAspect::Metric;
|
const auto aspect = QskAspect::NoSubcontrol | QskAspect::Metric;
|
||||||
|
|
||||||
setSkinHint( aspect | QskAspect::Margin, noMargins );
|
setSkinHint( aspect | QskAspect::Margin, noMargins );
|
||||||
setSkinHint( aspect | QskAspect::Padding, noMargins );
|
setSkinHint( aspect | QskAspect::Padding, noMargins );
|
||||||
|
|
|
@ -416,7 +416,7 @@ inline bool WindowAnimator::isControlAffected( const QskControl* control,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( subControl == QskAspect::Control )
|
if ( subControl == QskAspect::NoSubcontrol )
|
||||||
{
|
{
|
||||||
if ( !control->autoFillBackground() )
|
if ( !control->autoFillBackground() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -211,7 +211,7 @@ static inline QskAspect qskSubstitutedAspect(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
aspect.setSubControl( skinnable->effectiveSubcontrol( aspect.subControl() ) );
|
aspect.setSubcontrol( skinnable->effectiveSubcontrol( aspect.subControl() ) );
|
||||||
return aspect;
|
return aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,10 +297,10 @@ const QskSkinlet* QskSkinnable::effectiveSkinlet() const
|
||||||
void QskSkinnable::setSubcontrolProxy(
|
void QskSkinnable::setSubcontrolProxy(
|
||||||
QskAspect::Subcontrol subControl, QskAspect::Subcontrol proxy )
|
QskAspect::Subcontrol subControl, QskAspect::Subcontrol proxy )
|
||||||
{
|
{
|
||||||
if ( subControl == QskAspect::Control )
|
if ( subControl == QskAspect::NoSubcontrol )
|
||||||
return; // nonsense, we ignore this
|
return; // nonsense, we ignore this
|
||||||
|
|
||||||
if ( proxy == QskAspect::Control || subControl == proxy )
|
if ( proxy == QskAspect::NoSubcontrol || subControl == proxy )
|
||||||
{
|
{
|
||||||
resetSubcontrolProxy( subControl );
|
resetSubcontrolProxy( subControl );
|
||||||
return;
|
return;
|
||||||
|
@ -338,7 +338,7 @@ QskAspect::Subcontrol QskSkinnable::subcontrolProxy( QskAspect::Subcontrol subCo
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QskAspect::Control;
|
return QskAspect::NoSubcontrol;
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkinHintTable& QskSkinnable::hintTable()
|
QskSkinHintTable& QskSkinnable::hintTable()
|
||||||
|
@ -733,7 +733,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter(
|
||||||
if ( !status.isValid() )
|
if ( !status.isValid() )
|
||||||
return QskColorFilter();
|
return QskColorFilter();
|
||||||
|
|
||||||
aspect.setSubControl( status.aspect.subControl() );
|
aspect.setSubcontrol( status.aspect.subControl() );
|
||||||
aspect.setSection( QskAspect::Body );
|
aspect.setSection( QskAspect::Body );
|
||||||
aspect.setPlacement( QskAspect::NoPlacement );
|
aspect.setPlacement( QskAspect::NoPlacement );
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ QskColorFilter QskSkinnable::effectiveGraphicFilter(
|
||||||
bool QskSkinnable::setAnimationHint(
|
bool QskSkinnable::setAnimationHint(
|
||||||
QskAspect aspect, QskAnimationHint hint )
|
QskAspect aspect, QskAnimationHint hint )
|
||||||
{
|
{
|
||||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
aspect.setSubcontrol( effectiveSubcontrol( aspect.subControl() ) );
|
||||||
return m_data->hintTable.setAnimation( aspect, hint );
|
return m_data->hintTable.setAnimation( aspect, hint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,7 +865,7 @@ bool QskSkinnable::resetSkinHint( QskAspect aspect )
|
||||||
QVariant QskSkinnable::effectiveSkinHint(
|
QVariant QskSkinnable::effectiveSkinHint(
|
||||||
QskAspect aspect, QskSkinHintStatus* status ) const
|
QskAspect aspect, QskSkinHintStatus* status ) const
|
||||||
{
|
{
|
||||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
aspect.setSubcontrol( effectiveSubcontrol( aspect.subControl() ) );
|
||||||
|
|
||||||
if ( !( aspect.isAnimator() || aspect.hasStates() ) )
|
if ( !( aspect.isAnimator() || aspect.hasStates() ) )
|
||||||
{
|
{
|
||||||
|
@ -1049,11 +1049,11 @@ const QVariant& QskSkinnable::storedHint(
|
||||||
return *value;
|
return *value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( aspect.subControl() != QskAspect::Control )
|
if ( aspect.hasSubcontrol() )
|
||||||
{
|
{
|
||||||
// trying to resolve something from the skin default settings
|
// trying to resolve something from the skin default settings
|
||||||
|
|
||||||
aspect.setSubControl( QskAspect::Control );
|
aspect.clearSubcontrol();
|
||||||
aspect.clearStates();
|
aspect.clearStates();
|
||||||
|
|
||||||
if ( const auto value = skinTable.resolvedHint( aspect, &resolvedAspect ) )
|
if ( const auto value = skinTable.resolvedHint( aspect, &resolvedAspect ) )
|
||||||
|
@ -1225,7 +1225,7 @@ void QskSkinnable::startTransition( QskAspect aspect,
|
||||||
void QskSkinnable::startTransition( QskAspect aspect, int index,
|
void QskSkinnable::startTransition( QskAspect aspect, int index,
|
||||||
QskAnimationHint animationHint, const QVariant& from, const QVariant& to )
|
QskAnimationHint animationHint, const QVariant& from, const QVariant& to )
|
||||||
{
|
{
|
||||||
aspect.setSubControl( effectiveSubcontrol( aspect.subControl() ) );
|
aspect.setSubcontrol( effectiveSubcontrol( aspect.subControl() ) );
|
||||||
startHintTransition( aspect, index, animationHint, from, to );
|
startHintTransition( aspect, index, animationHint, from, to );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1359,7 +1359,7 @@ bool QskSkinnable::startHintTransitions(
|
||||||
const auto subControls = control->subControls();
|
const auto subControls = control->subControls();
|
||||||
for ( const auto subControl : subControls )
|
for ( const auto subControl : subControls )
|
||||||
{
|
{
|
||||||
aspect.setSubControl( subControl );
|
aspect.setSubcontrol( subControl );
|
||||||
|
|
||||||
const auto& skinTable = skin->hintTable();
|
const auto& skinTable = skin->hintTable();
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ void QskSubcontrolLayoutEngine::setGraphicTextElements( const QskSkinnable* skin
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GraphicElement* graphicElement = nullptr;
|
GraphicElement* graphicElement = nullptr;
|
||||||
if ( !graphicSize.isEmpty() && ( graphicSubControl != QskAspect::Control ) )
|
if ( !graphicSize.isEmpty() && ( graphicSubControl != QskAspect::NoSubcontrol ) )
|
||||||
{
|
{
|
||||||
graphicElement = dynamic_cast< GraphicElement* >( element( graphicSubControl ) );
|
graphicElement = dynamic_cast< GraphicElement* >( element( graphicSubControl ) );
|
||||||
if ( graphicElement == nullptr )
|
if ( graphicElement == nullptr )
|
||||||
|
@ -347,7 +347,7 @@ void QskSubcontrolLayoutEngine::setGraphicTextElements( const QskSkinnable* skin
|
||||||
}
|
}
|
||||||
|
|
||||||
TextElement* textElement = nullptr;
|
TextElement* textElement = nullptr;
|
||||||
if ( !text.isEmpty() && ( textSubcontrol != QskAspect::Control ) )
|
if ( !text.isEmpty() && ( textSubcontrol != QskAspect::NoSubcontrol ) )
|
||||||
{
|
{
|
||||||
textElement = dynamic_cast< TextElement* >( element( textSubcontrol ) );
|
textElement = dynamic_cast< TextElement* >( element( textSubcontrol ) );
|
||||||
if ( textElement == nullptr )
|
if ( textElement == nullptr )
|
||||||
|
|
Loading…
Reference in New Issue