some preparations for modifications with QskAspect
This commit is contained in:
parent
5f1b45177e
commit
f33f38bbbb
|
@ -97,6 +97,8 @@ DefaultSkin::~DefaultSkin()
|
|||
|
||||
void DefaultSkin::initHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
const int duration = 200; // for animators
|
||||
|
||||
setFont( QskSkin::DefaultFont, qskFont( 13 ) );
|
||||
|
@ -114,38 +116,38 @@ void DefaultSkin::initHints()
|
|||
setBoxShape( SoundControl::Marker, 100, Qt::RelativeSize );
|
||||
|
||||
setGradient( QskSeparator::Panel, m_palette->color3 );
|
||||
setMetric( QskSeparator::Panel | QskAspect::Size, 2 );
|
||||
setMetric( QskSeparator::Panel | Size, 2 );
|
||||
|
||||
// -- push buttons
|
||||
|
||||
setMargins( QskPushButton::Panel | QskAspect::Padding, 10 );
|
||||
setMargins( QskPushButton::Panel | Padding, 10 );
|
||||
setGradient( QskPushButton::Panel, m_palette->color1 );
|
||||
setColor( QskPushButton::Text, m_palette->color3 );
|
||||
setGradient( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
||||
setAnimation( QskPushButton::Panel | QskAspect::Color, duration );
|
||||
setAnimation( QskPushButton::Panel | Color, duration );
|
||||
|
||||
setGradient( SoundControl::SliderControl, m_palette->color1 );
|
||||
setGradient( SoundControl::SliderControl | QskPushButton::Pressed, m_palette->color2 );
|
||||
setAnimation( SoundControl::SliderControl | QskAspect::Color, duration );
|
||||
setAnimation( SoundControl::SliderControl | Color, duration );
|
||||
|
||||
setMetric( QskPushButton::Text | QskAspect::Size, 20 );
|
||||
setSkinHint( QskPushButton::Text | QskAspect::FontRole, int( QskSkin::LargeFont ) );
|
||||
setSkinHint( QskPushButton::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||
setMetric( QskPushButton::Text | Size, 20 );
|
||||
setSkinHint( QskPushButton::Text | FontRole, int( QskSkin::LargeFont ) );
|
||||
setSkinHint( QskPushButton::Text | Alignment, Qt::AlignCenter );
|
||||
|
||||
// -- a more advanced setup of the hints for the slider
|
||||
|
||||
const qreal dim = 30;
|
||||
|
||||
setMetric( QskSlider::Panel | QskAspect::Size, dim );
|
||||
setMetric( QskSlider::Panel | Size, dim );
|
||||
setGradient( QskSlider::Panel, QskGradient() );
|
||||
|
||||
setMetric( QskSlider::Groove | QskAspect::Size, 2 );
|
||||
setMetric( QskSlider::Groove | Size, 2 );
|
||||
setGradient( QskSlider::Groove, m_palette->color4 );
|
||||
|
||||
setMetric( QskSlider::Fill | QskAspect::Size, 2 );
|
||||
setMetric( QskSlider::Fill | Size, 2 );
|
||||
setGradient( QskSlider::Fill, m_palette->color4.darker( 200 ) );
|
||||
|
||||
setMetric( QskSlider::Handle | QskAspect::Size, 24 );
|
||||
setMetric( QskSlider::Handle | Size, 24 );
|
||||
setBoxBorderMetrics( QskSlider::Handle, 0 );
|
||||
setBoxShape( QskSlider::Handle, 100.0, Qt::RelativeSize );
|
||||
setGradient( QskSlider::Handle, m_palette->color5 );
|
||||
|
@ -157,28 +159,26 @@ void DefaultSkin::initHints()
|
|||
setBoxBorderColors( Speedometer::Panel, m_palette->color3 );
|
||||
|
||||
setBoxBorderMetrics( Speedometer::NeedleHead, 2 );
|
||||
setMetric( Speedometer::NeedleHead | QskAspect::Size, 15 );
|
||||
setMetric( Speedometer::NeedleHead | Size, 15 );
|
||||
setGradient( Speedometer::NeedleHead,
|
||||
QskGradient( QskGradient::Diagonal, m_palette->color2, m_palette->color1 ) );
|
||||
// setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );
|
||||
|
||||
setMetric( Speedometer::Needle | QskAspect::MinimumWidth, 2 );
|
||||
setMetric( Speedometer::Needle | QskAspect::Margin, 10 );
|
||||
setMetric( Speedometer::Needle | MinimumWidth, 2 );
|
||||
setMetric( Speedometer::Needle | Margin, 10 );
|
||||
setColor( Speedometer::Needle, m_palette->color2 );
|
||||
|
||||
// margins between numbers and ticks:
|
||||
setMargins( Speedometer::Labels, QskMargins( 4, 4, 4, 4 ) );
|
||||
setMetric( Speedometer::Labels | QskAspect::MinimumWidth, 2 );
|
||||
setMetric( Speedometer::Labels | QskAspect::Size, 15 ); // ticks size
|
||||
setMetric( Speedometer::Labels | MinimumWidth, 2 );
|
||||
setMetric( Speedometer::Labels | Size, 15 ); // ticks size
|
||||
setColor( Speedometer::Labels, m_palette->color4 );
|
||||
setFontRole( Speedometer::Labels, QskSkin::SmallFont );
|
||||
|
||||
// handle expanding, when being pressed
|
||||
for ( auto state : { QskAspect::NoState, QskSlider::Pressed } )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
const Aspect aspect = QskSlider::Handle | state;
|
||||
const auto aspect = QskSlider::Handle | state;
|
||||
|
||||
// fullsize, only when being pressed
|
||||
const qreal sz = ( state == NoState ) ? 0.7 * dim : dim;
|
||||
|
@ -190,10 +190,10 @@ void DefaultSkin::initHints()
|
|||
( state == NoState ) ? 2 * duration : 0 );
|
||||
}
|
||||
|
||||
setAnimation( QskSlider::Handle | QskAspect::Metric, duration );
|
||||
setAnimation( QskSlider::Handle | Metric, duration );
|
||||
|
||||
// animator for color scheme transitions
|
||||
setAnimation( QskAspect::Color, QskAnimationHint( 1000, QEasingCurve::InQuad ) );
|
||||
setAnimation( Color, QskAnimationHint( 1000, QEasingCurve::InQuad ) );
|
||||
}
|
||||
|
||||
void DefaultSkin::toggleScheme()
|
||||
|
|
|
@ -74,6 +74,8 @@ OtherSkin::~OtherSkin()
|
|||
|
||||
void OtherSkin::initHints()
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
const int duration = 200; // for animators
|
||||
|
||||
setFont( QskSkin::DefaultFont, qskFont( 13 ) );
|
||||
|
@ -88,17 +90,17 @@ void OtherSkin::initHints()
|
|||
setBoxBorderMetrics( SoundControl::Marker, 2 );
|
||||
setBoxShape( SoundControl::Marker, 100, Qt::RelativeSize );
|
||||
|
||||
setSkinHint( ButtonBar::Indicator | QskAspect::GraphicRole, SkinFactory::Indicator );
|
||||
setSkinHint( SoundControl::Vehicle | QskAspect::GraphicRole, SkinFactory::Vehicle );
|
||||
setSkinHint( SoundControl::MarkerControl | QskAspect::GraphicRole, SkinFactory::Vehicle );
|
||||
setSkinHint( ButtonBar::Indicator | GraphicRole, SkinFactory::Indicator );
|
||||
setSkinHint( SoundControl::Vehicle | GraphicRole, SkinFactory::Vehicle );
|
||||
setSkinHint( SoundControl::MarkerControl | GraphicRole, SkinFactory::Vehicle );
|
||||
|
||||
setBoxBorderMetrics( QskSeparator::Panel, 0 );
|
||||
setGradient( QskSeparator::Panel, m_palette->color3 );
|
||||
setMetric( QskSeparator::Panel | QskAspect::Size, 1 );
|
||||
setMetric( QskSeparator::Panel | Size, 1 );
|
||||
|
||||
// -- push buttons
|
||||
|
||||
setMargins( QskPushButton::Panel | QskAspect::Padding, 8 );
|
||||
setMargins( QskPushButton::Panel | Padding, 8 );
|
||||
setBoxBorderMetrics( QskPushButton::Panel, 0 );
|
||||
setBoxShape( QskPushButton::Panel, 4 );
|
||||
|
||||
|
@ -106,7 +108,7 @@ void OtherSkin::initHints()
|
|||
setGradient( QskPushButton::Panel | QskPushButton::Pressed, m_palette->color2 );
|
||||
|
||||
setColor( QskPushButton::Text, m_palette->color3 );
|
||||
setAnimation( QskPushButton::Panel | QskAspect::Color, duration );
|
||||
setAnimation( QskPushButton::Panel | Color, duration );
|
||||
|
||||
// -- overlay
|
||||
|
||||
|
@ -121,24 +123,24 @@ void OtherSkin::initHints()
|
|||
setGradient( SoundControl::SliderControl, m_palette->color1 );
|
||||
setGradient( SoundControl::SliderControl | QskPushButton::Pressed, m_palette->color2 );
|
||||
|
||||
setAnimation( SoundControl::SliderControl | QskAspect::Color, duration );
|
||||
setAnimation( SoundControl::SliderControl | Color, duration );
|
||||
|
||||
setMetric( QskPushButton::Text | QskAspect::Size, 20 );
|
||||
setSkinHint( QskPushButton::Text | QskAspect::FontRole, int( QskSkin::LargeFont ) );
|
||||
setSkinHint( QskPushButton::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||
setMetric( QskPushButton::Text | Size, 20 );
|
||||
setSkinHint( QskPushButton::Text | FontRole, int( QskSkin::LargeFont ) );
|
||||
setSkinHint( QskPushButton::Text | Alignment, Qt::AlignCenter );
|
||||
|
||||
// -- a more advanced setup of the hints for the slider
|
||||
|
||||
setMetric( QskSlider::Panel | QskAspect::Size, 30 );
|
||||
setMetric( QskSlider::Panel | Size, 30 );
|
||||
setGradient( QskSlider::Panel, QskGradient() );
|
||||
|
||||
setMetric( QskSlider::Groove | QskAspect::Size, 5 );
|
||||
setMetric( QskSlider::Groove | Size, 5 );
|
||||
setGradient( QskSlider::Groove, m_palette->color4.darker( 200 ) );
|
||||
|
||||
setMetric( QskSlider::Fill | QskAspect::Size, 5 );
|
||||
setMetric( QskSlider::Fill | Size, 5 );
|
||||
setGradient( QskSlider::Fill, m_palette->color3.lighter( 150 ) );
|
||||
|
||||
setMetric( QskSlider::Handle | QskAspect::Size, 22 );
|
||||
setMetric( QskSlider::Handle | Size, 22 );
|
||||
setBoxBorderMetrics( QskSlider::Handle, 0 );
|
||||
setBoxShape( QskSlider::Handle, 6 );
|
||||
setGradient( QskSlider::Handle, m_palette->color3 );
|
||||
|
@ -151,18 +153,18 @@ void OtherSkin::initHints()
|
|||
setBoxBorderColors( Speedometer::Panel, m_palette->color3 );
|
||||
|
||||
setBoxBorderMetrics( Speedometer::NeedleHead, 5 );
|
||||
setMetric( Speedometer::NeedleHead | QskAspect::Size, 10 );
|
||||
setMetric( Speedometer::NeedleHead | Size, 10 );
|
||||
setGradient( Speedometer::NeedleHead, m_palette->color2 );
|
||||
setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );
|
||||
|
||||
setMetric( Speedometer::Needle | QskAspect::MinimumWidth, 4 );
|
||||
setMetric( Speedometer::Needle | QskAspect::Margin, 15 );
|
||||
setMetric( Speedometer::Needle | MinimumWidth, 4 );
|
||||
setMetric( Speedometer::Needle | Margin, 15 );
|
||||
setColor( Speedometer::Needle, m_palette->color4 );
|
||||
|
||||
// margins between numbers and ticks:
|
||||
setMargins( Speedometer::Labels, QskMargins( 3, 3, 3, 3 ) );
|
||||
setMetric( Speedometer::Labels | QskAspect::MinimumWidth, 3 );
|
||||
setMetric( Speedometer::Labels | QskAspect::Size, 25 ); // ticks size
|
||||
setMetric( Speedometer::Labels | MinimumWidth, 3 );
|
||||
setMetric( Speedometer::Labels | Size, 25 ); // ticks size
|
||||
setColor( Speedometer::Labels, m_palette->color4 );
|
||||
setFontRole( Speedometer::Labels, QskSkin::SmallFont );
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ QSGNode* SpeedometerSkinlet::updatePanelNode(
|
|||
|
||||
QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, QSGNode* node ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
const int labelsCount = speedometer->labels().count();
|
||||
|
||||
// ### actually, we could draw labels with only one entry
|
||||
|
@ -138,7 +140,7 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
auto vertexData = geometry->vertexDataAsPoint2D();
|
||||
memset( vertexData, 0, static_cast< size_t >( geometry->vertexCount() ) );
|
||||
|
||||
const auto panelMargins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
const auto panelMargins = speedometer->marginsHint( Speedometer::Panel | Margin );
|
||||
|
||||
auto panelRect = subControlRect(
|
||||
speedometer, speedometer->contentsRect(), Speedometer::Panel );
|
||||
|
@ -153,7 +155,7 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
QFontMetricsF fontMetrics( speedometer->effectiveFont( Speedometer::Labels ) );
|
||||
|
||||
auto angle = startAngle;
|
||||
qreal length = speedometer->metric( Speedometer::Labels | QskAspect::Size );
|
||||
qreal length = speedometer->metric( Speedometer::Labels | Size );
|
||||
QVector< QString > labels = speedometer->labels();
|
||||
|
||||
// Create a series of tickmarks from minimum to maximum
|
||||
|
@ -212,7 +214,7 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
}
|
||||
}
|
||||
|
||||
auto lineWidth = speedometer->metric( Speedometer::Labels | QskAspect::MinimumWidth );
|
||||
auto lineWidth = speedometer->metric( Speedometer::Labels | MinimumWidth );
|
||||
geometry->setLineWidth( lineWidth );
|
||||
geometry->markVertexDataDirty();
|
||||
|
||||
|
@ -224,6 +226,8 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
|||
QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
||||
const Speedometer* speedometer, QSGNode* node ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
auto needleNode = static_cast< TicksNode* >( node );
|
||||
if ( needleNode == nullptr )
|
||||
needleNode = new TicksNode();
|
||||
|
@ -240,14 +244,14 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
|||
boxNode = static_cast< QskBoxNode* >( needleNode->childAtIndex( 0 ) );
|
||||
}
|
||||
|
||||
const auto margins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
const auto margins = speedometer->marginsHint( Speedometer::Panel | Margin );
|
||||
|
||||
auto panelRect = subControlRect(
|
||||
speedometer, speedometer->contentsRect(), Speedometer::Panel );
|
||||
|
||||
panelRect = panelRect.marginsRemoved( margins );
|
||||
|
||||
auto radius = speedometer->metric( Speedometer::NeedleHead | QskAspect::Size );
|
||||
auto radius = speedometer->metric( Speedometer::NeedleHead | Size );
|
||||
QPointF center = QPointF( panelRect.x() + panelRect.width() / 2,
|
||||
panelRect.y() + panelRect.height() / 2 );
|
||||
|
||||
|
@ -263,8 +267,8 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
|||
|
||||
auto panelRadius = static_cast< float >( panelRect.width() / 2 );
|
||||
|
||||
auto needleWidth = speedometer->metric( Speedometer::Needle | QskAspect::MinimumWidth );
|
||||
auto needleMargin = speedometer->metric( Speedometer::Needle | QskAspect::Margin );
|
||||
auto needleWidth = speedometer->metric( Speedometer::Needle | MinimumWidth );
|
||||
auto needleMargin = speedometer->metric( Speedometer::Needle | Margin );
|
||||
|
||||
float xStart = center.x();
|
||||
float yStart = center.y();
|
||||
|
|
|
@ -27,7 +27,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
const Aspect aspect = Panel | placement;
|
||||
const auto aspect = Panel | placement;
|
||||
|
||||
setMetric( aspect | Size, h );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
|
@ -45,7 +45,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
const Aspect aspect = Groove | placement;
|
||||
const auto aspect = Groove | placement;
|
||||
|
||||
setMetric( aspect | Size, 4 );
|
||||
setBoxBorderMetricsHint( aspect, 0 );
|
||||
|
@ -57,7 +57,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
// no Fill
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
const Aspect aspect = Fill | placement;
|
||||
const auto aspect = Fill | placement;
|
||||
setMetric( aspect | Size, 0 );
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ OtherSlider::OtherSlider( QQuickItem* parentItem )
|
|||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
const Aspect aspect = Handle | placement;
|
||||
const auto aspect = Handle | placement;
|
||||
|
||||
setBoxBorderMetricsHint( aspect, 1 );
|
||||
setBoxShapeHint( aspect, 4 );
|
||||
|
|
|
@ -281,7 +281,7 @@ void QskMaterialSkin::initSeparatorHints()
|
|||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
const Aspect aspect = Q::Panel | placement;
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
setMetric( aspect | Size, 4 );
|
||||
setBoxShape( Q::Panel, 0 );
|
||||
|
@ -505,7 +505,7 @@ void QskMaterialSkin::initSliderHints()
|
|||
|
||||
for ( auto state : { NoState, Q::Pressed, Q::Pressed | Q::Hovered } )
|
||||
{
|
||||
QskAspect::Aspect aspect = Q::Handle | Q::Minimum | state;
|
||||
const auto aspect = Q::Handle | Q::Minimum | state;
|
||||
setGradient( aspect, Grey300 );
|
||||
setBoxBorderColors( aspect, Grey );
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ void QskMaterialSkin::initTabButtonHints()
|
|||
|
||||
for ( const auto placement : { Left, Right, Top, Bottom } )
|
||||
{
|
||||
const Aspect aspect = Q::Panel | placement;
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
Qt::Edge edge;
|
||||
|
||||
|
|
|
@ -532,7 +532,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
|
||||
for ( auto placement : { Left, Right, Top, Bottom } )
|
||||
{
|
||||
const Aspect aspect = Q::Panel | placement;
|
||||
const auto aspect = Q::Panel | placement;
|
||||
|
||||
QskMargins margins0, margins1, padding;
|
||||
QskBoxBorderMetrics border( 1 );
|
||||
|
@ -599,7 +599,7 @@ void QskSquiekSkin::initTabButtonHints()
|
|||
setAnimation( Q::Panel | Metric, animationHint );
|
||||
|
||||
// text
|
||||
setSkinHint( Q::Text | QskAspect::Alignment, Qt::AlignCenter );
|
||||
setSkinHint( Q::Text | Alignment, Qt::AlignCenter );
|
||||
setColor( Q::Text, pal.themeForeground );
|
||||
setColor( Q::Text | Q::Checkable | Q::Disabled, pal.darker200 );
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ void QskSquiekSkin::initSliderHints()
|
|||
|
||||
for ( auto placement : { Horizontal, Vertical } )
|
||||
{
|
||||
Aspect aspect = Q::Handle | placement;
|
||||
const auto aspect = Q::Handle | placement;
|
||||
|
||||
setButton( aspect, Raised, 1 );
|
||||
setBoxShape( aspect, 20.0, Qt::RelativeSize );
|
||||
|
|
|
@ -145,7 +145,7 @@ void QskControl::setBackgroundColor( const QColor& color )
|
|||
void QskControl::setBackground( const QskGradient& gradient )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
const Aspect aspect = Control | Color;
|
||||
const auto aspect = Control | Color;
|
||||
|
||||
if ( hintTable().gradient( aspect ) != gradient )
|
||||
{
|
||||
|
|
|
@ -293,12 +293,6 @@ bool QskPopup::isTransitionAccepted( QskAspect::Aspect aspect ) const
|
|||
{
|
||||
if ( ( aspect.value() == 0 ) )
|
||||
{
|
||||
/*
|
||||
QskAspect::Aspect() is an early check that is used
|
||||
to find out if more detailed checking of aspects
|
||||
is necessary.
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ QskPushButton::~QskPushButton()
|
|||
void QskPushButton::setCorner( const QskCorner& corner )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
const Aspect aspect = Panel | Shape;
|
||||
const auto aspect = Panel | Shape;
|
||||
|
||||
if ( corner.metrics() != boxShapeHint( aspect ) )
|
||||
{
|
||||
|
@ -75,7 +75,7 @@ void QskPushButton::setCorner( const QskCorner& corner )
|
|||
QskCorner QskPushButton::corner() const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
const Aspect aspect = Panel | Shape;
|
||||
const auto aspect = Panel | Shape;
|
||||
|
||||
const auto shape = boxShapeHint( aspect );
|
||||
|
||||
|
|
|
@ -220,7 +220,9 @@ QRectF QskScrollViewSkinlet::viewportRect(
|
|||
QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
||||
const QRectF& contentsRect, Qt::Orientation orientation ) const
|
||||
{
|
||||
const Qt::Orientations scrollOrientations = scrollView->scrollableOrientations();
|
||||
using namespace QskAspect;
|
||||
|
||||
const auto scrollOrientations = scrollView->scrollableOrientations();
|
||||
if ( !( orientation & scrollOrientations ) )
|
||||
return QRectF();
|
||||
|
||||
|
@ -236,7 +238,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
const auto subControlBar = QskScrollView::VerticalScrollBar;
|
||||
|
||||
const QRectF sbRect = subControlRect( scrollView, contentsRect, subControlBar );
|
||||
const QMarginsF padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||
const QMarginsF padding = scrollView->marginsHint( subControlBar | Padding );
|
||||
|
||||
const qreal h = scrollView->scrollableSize().height();
|
||||
|
||||
|
@ -244,7 +246,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
const qreal y2 = ( pos.y() + vRect.height() ) / h;
|
||||
|
||||
const qreal minHandleLength =
|
||||
scrollView->metric( QskScrollView::VerticalScrollHandle | QskAspect::MinimumHeight );
|
||||
scrollView->metric( QskScrollView::VerticalScrollHandle | MinimumHeight );
|
||||
|
||||
qreal top, bottom;
|
||||
qskAlignedHandle( y1, y2, sbRect.height(), minHandleLength, top, bottom );
|
||||
|
@ -259,7 +261,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
const auto subControlBar = QskScrollView::HorizontalScrollBar;
|
||||
|
||||
const QRectF sbRect = subControlRect( scrollView, contentsRect, subControlBar );
|
||||
const auto padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||
const auto padding = scrollView->marginsHint( subControlBar | Padding );
|
||||
|
||||
const qreal w = scrollView->scrollableSize().width();
|
||||
|
||||
|
@ -267,7 +269,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
const qreal x2 = ( pos.x() + vRect.width() ) / w;
|
||||
|
||||
const qreal minHandleLength =
|
||||
scrollView->metric( QskScrollView::HorizontalScrollHandle | QskAspect::MinimumWidth );
|
||||
scrollView->metric( QskScrollView::HorizontalScrollHandle | MinimumWidth );
|
||||
|
||||
qreal left, right;
|
||||
qskAlignedHandle( x1, x2, sbRect.width(), minHandleLength, left, right );
|
||||
|
@ -284,7 +286,9 @@ QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
|||
QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
||||
const QRectF& contentsRect, Qt::Orientation orientation ) const
|
||||
{
|
||||
const Qt::Orientations scrollOrientations = scrollView->scrollableOrientations();
|
||||
using namespace QskAspect;
|
||||
|
||||
const auto scrollOrientations = scrollView->scrollableOrientations();
|
||||
if ( !( orientation & scrollOrientations ) )
|
||||
return QRectF();
|
||||
|
||||
|
@ -293,14 +297,14 @@ QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
|||
if ( orientation == Qt::Horizontal )
|
||||
{
|
||||
const qreal h = scrollView->metric(
|
||||
QskScrollView::HorizontalScrollBar | QskAspect::Size );
|
||||
QskScrollView::HorizontalScrollBar | Size );
|
||||
|
||||
r.setTop( r.bottom() - h );
|
||||
|
||||
if ( scrollOrientations & Qt::Vertical )
|
||||
{
|
||||
const qreal w = scrollView->metric(
|
||||
QskScrollView::VerticalScrollBar | QskAspect::Size );
|
||||
QskScrollView::VerticalScrollBar | Size );
|
||||
|
||||
r.setRight( r.right() - w );
|
||||
}
|
||||
|
@ -308,14 +312,14 @@ QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
|||
else
|
||||
{
|
||||
const qreal w = scrollView->metric(
|
||||
QskScrollView::VerticalScrollBar | QskAspect::Size );
|
||||
QskScrollView::VerticalScrollBar | Size );
|
||||
|
||||
r.setLeft( r.right() - w );
|
||||
|
||||
if ( scrollOrientations & Qt::Horizontal )
|
||||
{
|
||||
const qreal h = scrollView->metric(
|
||||
QskScrollView::HorizontalScrollBar | QskAspect::Size );
|
||||
QskScrollView::HorizontalScrollBar | Size );
|
||||
|
||||
r.setBottom( r.bottom() - h );
|
||||
}
|
||||
|
|
|
@ -60,9 +60,11 @@ void QskSeparator::setThickness( qreal thickness )
|
|||
{
|
||||
thickness = qMax( thickness, 0.0 );
|
||||
|
||||
if ( thickness != metric( qskAspectThickness() ) )
|
||||
const auto aspect = qskAspectThickness();
|
||||
|
||||
if ( thickness != metric( aspect ) )
|
||||
{
|
||||
setMetric( QskSeparator::Panel | QskAspect::Size, thickness );
|
||||
setMetric( aspect, thickness );
|
||||
|
||||
resetImplicitSize();
|
||||
update();
|
||||
|
|
|
@ -279,13 +279,13 @@ qreal QskSimpleListBox::columnWidth( int col ) const
|
|||
if ( col >= columnCount() )
|
||||
return 0.0;
|
||||
|
||||
const QMarginsF padding = marginsHint( Cell | QskAspect::Padding );
|
||||
const auto padding = marginsHint( Cell | QskAspect::Padding );
|
||||
return m_data->maxTextWidth + padding.left() + padding.right();
|
||||
}
|
||||
|
||||
qreal QskSimpleListBox::rowHeight() const
|
||||
{
|
||||
const QMarginsF padding = marginsHint( Cell | QskAspect::Padding );
|
||||
const auto padding = marginsHint( Cell | QskAspect::Padding );
|
||||
const QFontMetricsF fm( effectiveFont( Text ) );
|
||||
|
||||
return fm.height() + padding.top() + padding.bottom();
|
||||
|
|
|
@ -320,7 +320,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
const Subcontrol subControl = candidate.aspect.subControl();
|
||||
const auto subControl = candidate.aspect.subControl();
|
||||
if ( subControl != control->effectiveSubcontrol( subControl ) )
|
||||
{
|
||||
// The control uses subcontrol redirection, so we can assume it
|
||||
|
@ -345,7 +345,7 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
QskAspect::Aspect a = candidate.aspect;
|
||||
auto a = candidate.aspect;
|
||||
a.clearStates();
|
||||
a.addState( control->skinState() );
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ static inline QskTextColors qskTextColors(
|
|||
c.textColor = skinnable->color( subControl, &status );
|
||||
#if 1
|
||||
if ( !status.isValid() )
|
||||
c.textColor = skinnable->color( subControl | QskAspect::TextColor );
|
||||
c.textColor = skinnable->color( subControl | TextColor );
|
||||
#endif
|
||||
|
||||
c.styleColor = skinnable->color( subControl | StyleColor );
|
||||
|
|
|
@ -46,8 +46,8 @@ static inline bool qskCompareResolvedStates(
|
|||
if ( !table.hasStates() )
|
||||
return false;
|
||||
|
||||
const QskAspect::Aspect a1 = aspect1;
|
||||
const QskAspect::Aspect a2 = aspect2;
|
||||
const auto a1 = aspect1;
|
||||
const auto a2 = aspect2;
|
||||
|
||||
Q_FOREVER
|
||||
{
|
||||
|
@ -77,15 +77,17 @@ static inline bool qskCompareResolvedStates(
|
|||
|
||||
if ( s1 == 0 )
|
||||
{
|
||||
if ( aspect1.placement() == QskAspect::NoPlacement )
|
||||
using namespace QskAspect;
|
||||
|
||||
if ( aspect1.placement() == NoPlacement )
|
||||
return true;
|
||||
|
||||
// clear the placement bits and restart with the initial state
|
||||
aspect1 = a1;
|
||||
aspect1.setPlacement( QskAspect::NoPlacement );
|
||||
aspect1.setPlacement( NoPlacement );
|
||||
|
||||
aspect2 = a2;
|
||||
aspect2.setPlacement( QskAspect::NoPlacement );
|
||||
aspect2.setPlacement( NoPlacement );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -878,7 +880,7 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
|||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
Aspect aspect = subControl | placement;
|
||||
auto aspect = subControl | placement;
|
||||
|
||||
const auto& skinTable = skin->hintTable();
|
||||
|
||||
|
@ -898,8 +900,8 @@ void QskSkinnable::setSkinState( QskAspect::State newState, bool animated )
|
|||
{
|
||||
aspect.setPrimitive( type, primitive );
|
||||
|
||||
Aspect a1 = aspect | m_data->skinState;
|
||||
Aspect a2 = aspect | newState;
|
||||
auto a1 = aspect | m_data->skinState;
|
||||
auto a2 = aspect | newState;
|
||||
|
||||
bool doTransition = true;
|
||||
|
||||
|
|
|
@ -249,8 +249,6 @@ void QskSlider::moveHandle()
|
|||
|
||||
void QskSlider::moveHandleTo( qreal value, const QskAnimationHint& hint )
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
setSkinStateFlag( QskSlider::Minimum, value <= minimum() );
|
||||
setSkinStateFlag( QskSlider::Maximum, value >= maximum() );
|
||||
|
||||
|
|
Loading…
Reference in New Issue