making layout calculations of the skinlets independent from the current
of the control
This commit is contained in:
parent
3f1c5fc948
commit
91c16e8076
@ -47,13 +47,10 @@ SpeedometerSkinlet::SpeedometerSkinlet( QskSkin* skin )
|
||||
|
||||
SpeedometerSkinlet::~SpeedometerSkinlet() = default;
|
||||
|
||||
QRectF SpeedometerSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol ) const
|
||||
QRectF SpeedometerSkinlet::subControlRect( const QskSkinnable*,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol ) const
|
||||
{
|
||||
const auto speedometer = static_cast< const Speedometer* >( skinnable );
|
||||
|
||||
// ### differentiate for subcontrols
|
||||
return speedometer->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
QSGNode* SpeedometerSkinlet::updateSubNode(
|
||||
@ -77,7 +74,8 @@ QSGNode* SpeedometerSkinlet::updateSubNode(
|
||||
}
|
||||
}
|
||||
|
||||
QSGNode* SpeedometerSkinlet::updatePanelNode( const Speedometer* speedometer, QSGNode* node ) const
|
||||
QSGNode* SpeedometerSkinlet::updatePanelNode(
|
||||
const Speedometer* speedometer, QSGNode* node ) const
|
||||
{
|
||||
auto boxNode = static_cast< QskBoxNode* >( node );
|
||||
|
||||
@ -86,8 +84,11 @@ QSGNode* SpeedometerSkinlet::updatePanelNode( const Speedometer* speedometer, QS
|
||||
boxNode = new QskBoxNode;
|
||||
}
|
||||
|
||||
QRectF panelRect = subControlRect( speedometer, Speedometer::Panel );
|
||||
qreal radius = panelRect.width() / 2;
|
||||
const auto panelRect = subControlRect(
|
||||
speedometer, speedometer->contentsRect(), Speedometer::Panel );
|
||||
|
||||
const qreal radius = panelRect.width() / 2;
|
||||
|
||||
QskBoxShapeMetrics shapeMetrics( radius, radius, radius, radius );
|
||||
QskBoxBorderMetrics borderMetrics = speedometer->boxBorderMetricsHint( Speedometer::Panel );
|
||||
QskBoxBorderColors borderColors = speedometer->boxBorderColorsHint( Speedometer::Panel );
|
||||
@ -127,9 +128,11 @@ QSGNode* SpeedometerSkinlet::updateLabelsNode( const Speedometer* speedometer, Q
|
||||
auto vertexData = geometry->vertexDataAsPoint2D();
|
||||
memset( vertexData, 0, static_cast< size_t >( geometry->vertexCount() ) );
|
||||
|
||||
QMarginsF panelMargins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
const QRectF panelRect = subControlRect( speedometer,
|
||||
Speedometer::Panel ).marginsRemoved( panelMargins );
|
||||
const auto panelMargins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
|
||||
auto panelRect = subControlRect(
|
||||
speedometer, speedometer->contentsRect(), Speedometer::Panel );
|
||||
panelRect = panelRect.marginsRemoved( panelMargins );
|
||||
|
||||
QPointF center = QPointF( panelRect.x() + panelRect.width() / 2,
|
||||
panelRect.y() + panelRect.height() / 2 );
|
||||
@ -227,8 +230,13 @@ QSGNode* SpeedometerSkinlet::updateNeedleNode(
|
||||
boxNode = static_cast< QskBoxNode* >( needleNode->childAtIndex( 0 ) );
|
||||
}
|
||||
|
||||
QMarginsF margins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
const QRectF panelRect = subControlRect( speedometer, Speedometer::Panel ).marginsRemoved( margins );
|
||||
const auto margins = speedometer->marginsHint( Speedometer::Panel | QskAspect::Margin );
|
||||
|
||||
auto panelRect = subControlRect(
|
||||
speedometer, speedometer->contentsRect(), Speedometer::Panel );
|
||||
|
||||
panelRect = panelRect.marginsRemoved( margins );
|
||||
|
||||
auto radius = speedometer->metric( Speedometer::NeedleHead | QskAspect::Size );
|
||||
QPointF center = QPointF( panelRect.x() + panelRect.width() / 2,
|
||||
panelRect.y() + panelRect.height() / 2 );
|
||||
|
@ -20,8 +20,8 @@ class SpeedometerSkinlet : public QskSkinlet
|
||||
Q_INVOKABLE SpeedometerSkinlet( QskSkin* skin = nullptr );
|
||||
~SpeedometerSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable* skinnable,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
virtual QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -33,8 +33,8 @@ MyToggleButtonSkinlet::MyToggleButtonSkinlet( QskSkin* skin )
|
||||
);
|
||||
}
|
||||
|
||||
QRectF MyToggleButtonSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF MyToggleButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
using Q = MyToggleButton;
|
||||
|
||||
@ -42,25 +42,25 @@ QRectF MyToggleButtonSkinlet::subControlRect(
|
||||
|
||||
if( subControl == Q::Panel )
|
||||
{
|
||||
return button->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
else if( subControl == Q::UncheckedPanel )
|
||||
{
|
||||
const auto rect = innerRect( skinnable, Q::Panel );
|
||||
return sectionRect( rect, button->isInverted() ? 0 : 1 );
|
||||
const auto r = innerRect( skinnable, contentsRect, Q::Panel );
|
||||
return sectionRect( r, button->isInverted() ? 0 : 1 );
|
||||
}
|
||||
else if( subControl == Q::CheckedPanel )
|
||||
{
|
||||
const auto rect = innerRect( skinnable, Q::Panel );
|
||||
return sectionRect( rect, button->isInverted() ? 1 : 0 );
|
||||
const auto r = innerRect( skinnable, contentsRect, Q::Panel );
|
||||
return sectionRect( r, button->isInverted() ? 1 : 0 );
|
||||
}
|
||||
else if( subControl == Q::CheckedLabel || subControl == Q::CheckedIcon )
|
||||
{
|
||||
return innerRect( skinnable, Q::CheckedPanel );
|
||||
return innerRect( skinnable, contentsRect, Q::CheckedPanel );
|
||||
}
|
||||
else if( subControl == Q::UncheckedLabel || subControl == Q::UncheckedIcon )
|
||||
{
|
||||
return innerRect( skinnable, Q::UncheckedPanel );
|
||||
return innerRect( skinnable, contentsRect, Q::UncheckedPanel );
|
||||
}
|
||||
else if( subControl == Q::Cursor )
|
||||
{
|
||||
@ -68,7 +68,7 @@ QRectF MyToggleButtonSkinlet::subControlRect(
|
||||
if ( button->isInverted() )
|
||||
position = 1.0 - position;
|
||||
|
||||
auto rect = innerRect( skinnable, Q::Panel );
|
||||
auto rect = innerRect( skinnable, contentsRect, Q::Panel );
|
||||
|
||||
rect.setWidth( 0.5 * rect.width() );
|
||||
rect.moveLeft( rect.left() + position * rect.width() );
|
||||
@ -76,13 +76,14 @@ QRectF MyToggleButtonSkinlet::subControlRect(
|
||||
return rect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QRectF MyToggleButtonSkinlet::innerRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF MyToggleButtonSkinlet::innerRect( const QskSkinnable* skinnable,
|
||||
const QRectF& rect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
return skinnable->innerBox( subControl, subControlRect( skinnable, subControl ) );
|
||||
const auto r = subControlRect( skinnable, rect, subControl );
|
||||
return skinnable->innerBox( subControl, r );
|
||||
}
|
||||
|
||||
QSGNode* MyToggleButtonSkinlet::updateSubNode(
|
||||
|
@ -34,13 +34,15 @@ class MyToggleButtonSkinlet : public QskSkinlet
|
||||
Q_INVOKABLE MyToggleButtonSkinlet( QskSkin* = nullptr );
|
||||
~MyToggleButtonSkinlet() override = default;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*, QskAspect::Subcontrol ) const override;
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*, quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRectF innerRect( const QskSkinnable*, QskAspect::Subcontrol ) const;
|
||||
QRectF innerRect( const QskSkinnable*,
|
||||
const QRectF&, QskAspect::Subcontrol ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -120,8 +120,8 @@ SliderSkinlet::~SliderSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF SliderSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto slider = static_cast< const QskSlider* >( skinnable );
|
||||
|
||||
@ -131,22 +131,22 @@ QRectF SliderSkinlet::subControlRect(
|
||||
}
|
||||
else if ( subControl == QskSlider::Fill )
|
||||
{
|
||||
return fillRect( slider );
|
||||
return fillRect( slider, contentsRect );
|
||||
}
|
||||
else if ( subControl == QskSlider::Handle )
|
||||
{
|
||||
return handleRect( slider );
|
||||
return handleRect( slider, contentsRect );
|
||||
}
|
||||
else if ( subControl == Slider::Scale )
|
||||
{
|
||||
return scaleRect( slider );
|
||||
return scaleRect( contentsRect );
|
||||
}
|
||||
else if ( subControl == Slider::Decoration )
|
||||
{
|
||||
return decorationRect( slider );
|
||||
return decorationRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* SliderSkinlet::updateSubNode(
|
||||
@ -173,9 +173,9 @@ QSGNode* SliderSkinlet::updateSubNode(
|
||||
}
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::scaleRect( const QskSlider* slider ) const
|
||||
QRectF SliderSkinlet::scaleRect( const QRectF& contentsRect ) const
|
||||
{
|
||||
auto r = slider->contentsRect();
|
||||
auto r = contentsRect;
|
||||
|
||||
r.setX( r.left() + qskMargin );
|
||||
r.setBottom( r.center().y() );
|
||||
@ -185,9 +185,10 @@ QRectF SliderSkinlet::scaleRect( const QskSlider* slider ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::fillRect( const QskSlider* slider ) const
|
||||
QRectF SliderSkinlet::fillRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
auto r = subControlRect( slider, Slider::Scale );
|
||||
auto r = subControlRect( slider, contentsRect, Slider::Scale );
|
||||
|
||||
r.setTop( r.bottom() - qskMinorTick );
|
||||
r.setWidth( r.width() * slider->position() );
|
||||
@ -195,22 +196,23 @@ QRectF SliderSkinlet::fillRect( const QskSlider* slider ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::decorationRect( const QskSlider* slider ) const
|
||||
QRectF SliderSkinlet::decorationRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
// decoration exceeds scale !!!!
|
||||
|
||||
auto r = subControlRect( slider, Slider::Scale );
|
||||
auto r = subControlRect( slider, contentsRect, Slider::Scale );
|
||||
r.setBottom( r.top() );
|
||||
r.setTop( r.bottom() - QFontMetricsF( qskLabelFont ).height() );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF SliderSkinlet::handleRect( const QskSlider* slider ) const
|
||||
QRectF SliderSkinlet::handleRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
const QRectF contentsRect = slider->contentsRect();
|
||||
const QRectF fillRect = subControlRect( slider, QskSlider::Fill );
|
||||
const QRectF scaleRect = subControlRect( slider, Slider::Scale );
|
||||
const QRectF fillRect = subControlRect( slider, contentsRect, QskSlider::Fill );
|
||||
const QRectF scaleRect = subControlRect( slider, contentsRect, Slider::Scale );
|
||||
|
||||
QRectF handleRect( 0, scaleRect.bottom(), 80, 50 );
|
||||
handleRect.moveCenter( QPointF( fillRect.right(), handleRect.center().y() ) );
|
||||
@ -226,7 +228,9 @@ QRectF SliderSkinlet::handleRect( const QskSlider* slider ) const
|
||||
QSGNode* SliderSkinlet::updateScaleNode(
|
||||
const QskSlider* slider, QSGNode* node ) const
|
||||
{
|
||||
const QRectF scaleRect = subControlRect( slider, Slider::Scale );
|
||||
const auto scaleRect = subControlRect(
|
||||
slider, slider->contentsRect(), Slider::Scale );
|
||||
|
||||
if ( scaleRect.isEmpty() )
|
||||
return nullptr;
|
||||
|
||||
@ -267,7 +271,9 @@ QSGNode* SliderSkinlet::updateScaleNode(
|
||||
QSGNode* SliderSkinlet::updateDecorationNode(
|
||||
const QskSlider* slider, QSGNode* node ) const
|
||||
{
|
||||
const QRectF decorationRect = subControlRect( slider, Slider::Decoration );
|
||||
const QRectF decorationRect = subControlRect(
|
||||
slider, slider->contentsRect(), Slider::Decoration );
|
||||
|
||||
if ( decorationRect.isEmpty() )
|
||||
return nullptr;
|
||||
|
||||
@ -317,11 +323,14 @@ QSGNode* SliderSkinlet::updateDecorationNode(
|
||||
QSGNode* SliderSkinlet::updateHandleNode(
|
||||
const QskSlider* slider, QSGNode* node ) const
|
||||
{
|
||||
const QRectF handleRect = subControlRect( slider, QskSlider::Handle );
|
||||
const QRectF handleRect = subControlRect(
|
||||
slider, slider->contentsRect(), QskSlider::Handle );
|
||||
|
||||
if ( handleRect.isEmpty() )
|
||||
return nullptr;
|
||||
|
||||
const QRectF fillRect = subControlRect( slider, QskSlider::Fill );
|
||||
const QRectF fillRect = subControlRect(
|
||||
slider, slider->contentsRect(), QskSlider::Fill );
|
||||
|
||||
auto handleNode = static_cast< HandleNode* >( node );
|
||||
if ( handleNode == nullptr )
|
||||
|
@ -26,7 +26,7 @@ class SliderSkinlet : public QskSliderSkinlet
|
||||
~SliderSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
@ -37,10 +37,10 @@ class SliderSkinlet : public QskSliderSkinlet
|
||||
QSGNode* updateDecorationNode( const QskSlider*, QSGNode* ) const;
|
||||
QSGNode* updateHandleNode( const QskSlider*, QSGNode* ) const;
|
||||
|
||||
QRectF fillRect( const QskSlider* ) const;
|
||||
QRectF scaleRect( const QskSlider* ) const;
|
||||
QRectF decorationRect( const QskSlider* ) const;
|
||||
QRectF handleRect( const QskSlider* ) const;
|
||||
QRectF scaleRect( const QRectF& ) const;
|
||||
QRectF fillRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF decorationRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF handleRect( const QskSlider*, const QRectF& ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,16 +16,15 @@ QskBoxSkinlet::~QskBoxSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskBoxSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
if ( subControl == QskBox::Panel )
|
||||
{
|
||||
const auto box = static_cast< const QskBox* >( skinnable );
|
||||
return box->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskBoxSkinlet::updateSubNode(
|
||||
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskBoxSkinlet : public QskSkinlet
|
||||
~QskBoxSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "QskQuick.h"
|
||||
#include "QskSetup.h"
|
||||
#include "QskSkin.h"
|
||||
#include "QskSkinlet.h"
|
||||
#include "QskSkinHintTable.h"
|
||||
|
||||
#include <qglobalstatic.h>
|
||||
@ -1007,6 +1008,11 @@ QRectF QskControl::contentsRect() const
|
||||
return qskValidOrEmptyInnerRect( rect(), margins() );
|
||||
}
|
||||
|
||||
QRectF QskControl::subControlRect( QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
return effectiveSkinlet()->subControlRect( this, contentsRect(), subControl );
|
||||
}
|
||||
|
||||
bool QskControl::layoutMirroring() const
|
||||
{
|
||||
return d_func()->effectiveLayoutMirror;
|
||||
|
@ -115,6 +115,8 @@ class QSK_EXPORT QskControl : public QQuickItem, public QskSkinnable
|
||||
virtual QRectF gestureRect() const;
|
||||
virtual QRectF focusIndicatorRect() const;
|
||||
|
||||
QRectF subControlRect( QskAspect::Subcontrol ) const;
|
||||
|
||||
void setAutoFillBackground( bool );
|
||||
bool autoFillBackground() const;
|
||||
|
||||
|
@ -14,17 +14,15 @@ QskFocusIndicatorSkinlet::QskFocusIndicatorSkinlet( QskSkin* skin )
|
||||
|
||||
QskFocusIndicatorSkinlet::~QskFocusIndicatorSkinlet() = default;
|
||||
|
||||
QRectF QskFocusIndicatorSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskFocusIndicatorSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto indicator = static_cast< const QskFocusIndicator* >( skinnable );
|
||||
|
||||
if ( subControl == QskFocusIndicator::Panel )
|
||||
{
|
||||
return indicator->rect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskFocusIndicatorSkinlet::updateSubNode(
|
||||
|
@ -26,7 +26,7 @@ class QSK_EXPORT QskFocusIndicatorSkinlet : public QskSkinlet
|
||||
~QskFocusIndicatorSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -20,17 +20,17 @@ QskGraphicLabelSkinlet::QskGraphicLabelSkinlet( QskSkin* skin )
|
||||
|
||||
QskGraphicLabelSkinlet::~QskGraphicLabelSkinlet() = default;
|
||||
|
||||
QRectF QskGraphicLabelSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskGraphicLabelSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto label = static_cast< const QskGraphicLabel* >( skinnable );
|
||||
|
||||
if ( subControl == QskGraphicLabel::Graphic )
|
||||
{
|
||||
return graphicRect( label );
|
||||
return graphicRect( label, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskGraphicLabelSkinlet::updateSubNode(
|
||||
@ -49,14 +49,15 @@ QSGNode* QskGraphicLabelSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRect QskGraphicLabelSkinlet::graphicRect( const QskGraphicLabel* label ) const
|
||||
QRect QskGraphicLabelSkinlet::graphicRect(
|
||||
const QskGraphicLabel* label, const QRectF& contentsRect ) const
|
||||
{
|
||||
// textures are in integers, to avoid useless recalculations
|
||||
// that finally will be rounded anyway, we calculate in integers
|
||||
|
||||
const auto fillMode = label->fillMode();
|
||||
|
||||
const QRect graphicRect = label->contentsRect().toAlignedRect();
|
||||
const QRect graphicRect = contentsRect.toAlignedRect();
|
||||
|
||||
if ( fillMode == QskGraphicLabel::Stretch )
|
||||
{
|
||||
@ -82,7 +83,7 @@ QSGNode* QskGraphicLabelSkinlet::updateGraphicNode(
|
||||
const QskGraphicLabel* label, QSGNode* node ) const
|
||||
{
|
||||
const auto colorFilter = label->graphicFilter();
|
||||
const auto rect = subControlRect( label, QskGraphicLabel::Graphic );
|
||||
const auto rect = label->subControlRect( QskGraphicLabel::Graphic );
|
||||
|
||||
if ( label->fillMode() == QskGraphicLabel::Stretch )
|
||||
{
|
||||
|
@ -26,14 +26,14 @@ class QSK_EXPORT QskGraphicLabelSkinlet : public QskSkinlet
|
||||
~QskGraphicLabelSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRect graphicRect( const QskGraphicLabel* ) const;
|
||||
QRect graphicRect( const QskGraphicLabel*, const QRectF& ) const;
|
||||
QSGNode* updateGraphicNode( const QskGraphicLabel*, QSGNode* ) const;
|
||||
};
|
||||
|
||||
|
@ -18,17 +18,15 @@ QskPageIndicatorSkinlet::~QskPageIndicatorSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskPageIndicatorSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskPageIndicatorSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto indicator = static_cast< const QskPageIndicator* >( skinnable );
|
||||
|
||||
if ( subControl == QskPageIndicator::Panel )
|
||||
{
|
||||
return indicator->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskPageIndicatorSkinlet::updateSubNode(
|
||||
@ -137,7 +135,7 @@ QSGNode* QskPageIndicatorSkinlet::updateBulletsNode(
|
||||
if ( node == nullptr )
|
||||
node = new QSGNode();
|
||||
|
||||
QRectF rect = subControlRect( indicator, QskPageIndicator::Panel );
|
||||
QRectF rect = indicator->subControlRect( QskPageIndicator::Panel );
|
||||
rect = indicator->innerBox( QskPageIndicator::Panel, rect );
|
||||
|
||||
// index of the highlighted bullet
|
||||
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskPageIndicatorSkinlet : public QskSkinlet
|
||||
~QskPageIndicatorSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -14,15 +14,15 @@ QskPopupSkinlet::QskPopupSkinlet( QskSkin* skin )
|
||||
|
||||
QskPopupSkinlet::~QskPopupSkinlet() = default;
|
||||
|
||||
QRectF QskPopupSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskPopupSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto popup = static_cast< const QskPopup* >( skinnable );
|
||||
|
||||
if ( subControl == QskPopup::Overlay )
|
||||
return popup->overlayRect();
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskPopupSkinlet::updateSubNode(
|
||||
|
@ -26,7 +26,7 @@ class QSK_EXPORT QskPopupSkinlet : public QskSkinlet
|
||||
~QskPopupSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -247,7 +247,7 @@ void QskPushButton::updateLayout()
|
||||
|
||||
QRectF QskPushButton::layoutRect() const
|
||||
{
|
||||
return innerBox( Panel, effectiveSkinlet()->subControlRect( this, Panel ) );
|
||||
return innerBox( Panel, subControlRect( Panel ) );
|
||||
}
|
||||
|
||||
QSizeF QskPushButton::contentsSizeHint() const
|
||||
|
@ -20,25 +20,25 @@ QskPushButtonSkinlet::QskPushButtonSkinlet( QskSkin* skin )
|
||||
|
||||
QskPushButtonSkinlet::~QskPushButtonSkinlet() = default;
|
||||
|
||||
QRectF QskPushButtonSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskPushButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto button = static_cast< const QskPushButton* >( skinnable );
|
||||
|
||||
if ( subControl == QskPushButton::Text )
|
||||
{
|
||||
return textRect( button );
|
||||
return textRect( button, contentsRect );
|
||||
}
|
||||
else if ( subControl == QskPushButton::Graphic )
|
||||
{
|
||||
return graphicRect( button );
|
||||
return graphicRect( button, contentsRect );
|
||||
}
|
||||
else if ( subControl == QskPushButton::Panel )
|
||||
{
|
||||
return button->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskPushButtonSkinlet::updateSubNode(
|
||||
@ -68,12 +68,13 @@ QSGNode* QskPushButtonSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const
|
||||
QRectF QskPushButtonSkinlet::textRect(
|
||||
const QskPushButton* button, const QRectF& contentsRect ) const
|
||||
{
|
||||
// buttonShift -> TODO
|
||||
|
||||
QRectF r = button->innerBox( QskPushButton::Panel,
|
||||
subControlRect( button, QskPushButton::Panel ) );
|
||||
subControlRect( button, contentsRect, QskPushButton::Panel ) );
|
||||
|
||||
if ( button->hasGraphic() )
|
||||
{
|
||||
@ -87,14 +88,17 @@ QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF QskPushButtonSkinlet::graphicRect( const QskPushButton* button ) const
|
||||
QRectF QskPushButtonSkinlet::graphicRect(
|
||||
const QskPushButton* button, const QRectF& contentsRect ) const
|
||||
{
|
||||
// buttonShift -> TODO
|
||||
QRectF r = button->innerBox( QskPushButton::Panel, button->contentsRect() );
|
||||
|
||||
QRectF r = button->innerBox( QskPushButton::Panel,
|
||||
subControlRect( button, contentsRect, QskPushButton::Panel ) );
|
||||
|
||||
if ( !button->text().isEmpty() )
|
||||
{
|
||||
qreal h = textRect( button ).height() +
|
||||
qreal h = textRect( button, contentsRect ).height() +
|
||||
button->metric( QskPushButton::Panel | QskAspect::Spacing );
|
||||
|
||||
if ( h < r.height() )
|
||||
@ -149,7 +153,7 @@ QRectF QskPushButtonSkinlet::graphicRect( const QskPushButton* button ) const
|
||||
QSGNode* QskPushButtonSkinlet::updateTextNode(
|
||||
const QskPushButton* button, QSGNode* node ) const
|
||||
{
|
||||
const auto rect = subControlRect( button, QskPushButton::Text ).toAlignedRect();
|
||||
const auto rect = button->subControlRect( QskPushButton::Text ).toAlignedRect();
|
||||
|
||||
const QFontMetricsF fm( button->effectiveFont( QskPushButton::Text ) );
|
||||
if ( !button->clip() && ( rect.height() < fm.height() ) )
|
||||
|
@ -28,15 +28,15 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
|
||||
~QskPushButtonSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRectF textRect( const QskPushButton* ) const;
|
||||
QRectF graphicRect( const QskPushButton* ) const;
|
||||
QRectF textRect( const QskPushButton*, const QRectF& ) const;
|
||||
QRectF graphicRect( const QskPushButton*, const QRectF& ) const;
|
||||
|
||||
QSGNode* updateTextNode( const QskPushButton*, QSGNode* ) const;
|
||||
};
|
||||
|
@ -47,43 +47,42 @@ QskScrollViewSkinlet::QskScrollViewSkinlet( QskSkin* skin )
|
||||
|
||||
QskScrollViewSkinlet::~QskScrollViewSkinlet() = default;
|
||||
|
||||
QRectF QskScrollViewSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskScrollViewSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto scrollView = static_cast< const QskScrollView* >( skinnable );
|
||||
|
||||
if ( subControl == QskScrollView::Panel )
|
||||
{
|
||||
// layoutRect ???
|
||||
return scrollView->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
if ( subControl == QskScrollView::Viewport )
|
||||
{
|
||||
return viewportRect( scrollView );
|
||||
return viewportRect( scrollView, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskScrollView::HorizontalScrollBar )
|
||||
{
|
||||
return scrollBarRect( scrollView, Qt::Horizontal );
|
||||
return scrollBarRect( scrollView, contentsRect, Qt::Horizontal );
|
||||
}
|
||||
|
||||
if ( subControl == QskScrollView::HorizontalScrollHandle )
|
||||
{
|
||||
return scrollHandleRect( scrollView, Qt::Horizontal );
|
||||
return scrollHandleRect( scrollView, contentsRect, Qt::Horizontal );
|
||||
}
|
||||
|
||||
if ( subControl == QskScrollView::VerticalScrollBar )
|
||||
{
|
||||
return scrollBarRect( scrollView, Qt::Vertical );
|
||||
return scrollBarRect( scrollView, contentsRect, Qt::Vertical );
|
||||
}
|
||||
|
||||
if ( subControl == QskScrollView::VerticalScrollHandle )
|
||||
{
|
||||
return scrollHandleRect( scrollView, Qt::Vertical );
|
||||
return scrollHandleRect( scrollView, contentsRect, Qt::Vertical );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskScrollViewSkinlet::updateSubNode(
|
||||
@ -182,23 +181,28 @@ QSGNode* QskScrollViewSkinlet::contentsNode( const QskScrollView* scrollView )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QRectF QskScrollViewSkinlet::viewportRect( const QskScrollView* scrollView ) const
|
||||
QRectF QskScrollViewSkinlet::viewportRect(
|
||||
const QskScrollView* scrollView, const QRectF& contentsRect ) const
|
||||
{
|
||||
const Qt::Orientations orientation = scrollView->scrollableOrientations();
|
||||
|
||||
QRectF vr = subControlRect( scrollView, QskScrollView::Panel );
|
||||
QRectF vr = subControlRect( scrollView, contentsRect, QskScrollView::Panel );
|
||||
const qreal spacing = scrollView->metric( QskScrollView::Panel | QskAspect::Spacing );
|
||||
|
||||
if ( orientation & Qt::Vertical )
|
||||
{
|
||||
const QRectF r = subControlRect( scrollView, QskScrollView::VerticalScrollBar );
|
||||
const QRectF r = subControlRect(
|
||||
scrollView, contentsRect, QskScrollView::VerticalScrollBar );
|
||||
|
||||
if ( r.width() > 0.0 )
|
||||
vr.setWidth( vr.width() - r.width() - spacing );
|
||||
}
|
||||
|
||||
if ( orientation & Qt::Horizontal )
|
||||
{
|
||||
const QRectF r = subControlRect( scrollView, QskScrollView::HorizontalScrollBar );
|
||||
const QRectF r = subControlRect(
|
||||
scrollView, contentsRect, QskScrollView::HorizontalScrollBar );
|
||||
|
||||
if ( r.height() >= 0.0 )
|
||||
vr.setHeight( vr.height() - r.height() - spacing );
|
||||
}
|
||||
@ -206,15 +210,17 @@ QRectF QskScrollViewSkinlet::viewportRect( const QskScrollView* scrollView ) con
|
||||
return vr;
|
||||
}
|
||||
|
||||
QRectF QskScrollViewSkinlet::scrollHandleRect(
|
||||
const QskScrollView* scrollView, Qt::Orientation orientation ) const
|
||||
QRectF QskScrollViewSkinlet::scrollHandleRect( const QskScrollView* scrollView,
|
||||
const QRectF& contentsRect, Qt::Orientation orientation ) const
|
||||
{
|
||||
const Qt::Orientations scrollOrientations = scrollView->scrollableOrientations();
|
||||
if ( !( orientation & scrollOrientations ) )
|
||||
return QRectF();
|
||||
|
||||
const QPointF pos = scrollView->scrollPos();
|
||||
const QRectF vRect = subControlRect( scrollView, QskScrollView::Viewport );
|
||||
|
||||
const QRectF vRect = subControlRect(
|
||||
scrollView, contentsRect, QskScrollView::Viewport );
|
||||
|
||||
QRectF handleRect;
|
||||
|
||||
@ -222,7 +228,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect(
|
||||
{
|
||||
const auto subControlBar = QskScrollView::VerticalScrollBar;
|
||||
|
||||
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
||||
const QRectF sbRect = subControlRect( scrollView, contentsRect, subControlBar );
|
||||
const QMarginsF padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||
|
||||
const qreal h = scrollView->scrollableSize().height();
|
||||
@ -245,7 +251,7 @@ QRectF QskScrollViewSkinlet::scrollHandleRect(
|
||||
{
|
||||
const auto subControlBar = QskScrollView::HorizontalScrollBar;
|
||||
|
||||
const QRectF sbRect = subControlRect( scrollView, subControlBar );
|
||||
const QRectF sbRect = subControlRect( scrollView, contentsRect, subControlBar );
|
||||
const auto padding = scrollView->marginsHint( subControlBar | QskAspect::Padding );
|
||||
|
||||
const qreal w = scrollView->scrollableSize().width();
|
||||
@ -268,14 +274,14 @@ QRectF QskScrollViewSkinlet::scrollHandleRect(
|
||||
return handleRect;
|
||||
}
|
||||
|
||||
QRectF QskScrollViewSkinlet::scrollBarRect(
|
||||
const QskScrollView* scrollView, Qt::Orientation orientation ) const
|
||||
QRectF QskScrollViewSkinlet::scrollBarRect( const QskScrollView* scrollView,
|
||||
const QRectF& contentsRect, Qt::Orientation orientation ) const
|
||||
{
|
||||
const Qt::Orientations scrollOrientations = scrollView->scrollableOrientations();
|
||||
if ( !( orientation & scrollOrientations ) )
|
||||
return QRectF();
|
||||
|
||||
QRectF r = subControlRect( scrollView, QskScrollView::Panel );
|
||||
QRectF r = subControlRect( scrollView, contentsRect, QskScrollView::Panel );
|
||||
|
||||
if ( orientation == Qt::Horizontal )
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskScrollViewSkinlet : public QskSkinlet
|
||||
~QskScrollViewSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
@ -45,9 +45,9 @@ class QSK_EXPORT QskScrollViewSkinlet : public QskSkinlet
|
||||
private:
|
||||
QSGNode* updateContentsRootNode( const QskScrollView*, QSGNode* ) const;
|
||||
|
||||
QRectF viewportRect( const QskScrollView* ) const;
|
||||
QRectF scrollBarRect( const QskScrollView*, Qt::Orientation ) const;
|
||||
QRectF scrollHandleRect( const QskScrollView*, Qt::Orientation ) const;
|
||||
QRectF viewportRect( const QskScrollView*, const QRectF& ) const;
|
||||
QRectF scrollBarRect( const QskScrollView*, const QRectF&, Qt::Orientation ) const;
|
||||
QRectF scrollHandleRect( const QskScrollView*, const QRectF&, Qt::Orientation ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,17 +16,17 @@ QskSeparatorSkinlet::QskSeparatorSkinlet( QskSkin* skin )
|
||||
|
||||
QskSeparatorSkinlet::~QskSeparatorSkinlet() = default;
|
||||
|
||||
QRectF QskSeparatorSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskSeparatorSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto separator = static_cast< const QskSeparator* >( skinnable );
|
||||
|
||||
if ( subControl == QskSeparator::Panel )
|
||||
{
|
||||
return panelRect( separator );
|
||||
return panelRect( separator, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskSeparatorSkinlet::updateSubNode(
|
||||
@ -45,25 +45,25 @@ QSGNode* QskSeparatorSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRectF QskSeparatorSkinlet::panelRect( const QskSeparator* separator ) const
|
||||
QRectF QskSeparatorSkinlet::panelRect(
|
||||
const QskSeparator* separator, const QRectF& contentsRect ) const
|
||||
{
|
||||
const QRectF cr = separator->contentsRect();
|
||||
const qreal m = separator->metric( QskSeparator::Panel | QskAspect::Size );
|
||||
|
||||
QRectF r;
|
||||
|
||||
if ( separator->orientation() == Qt::Horizontal )
|
||||
{
|
||||
r.setWidth( cr.width() );
|
||||
r.setWidth( contentsRect.width() );
|
||||
r.setHeight( m );
|
||||
}
|
||||
else
|
||||
{
|
||||
r.setHeight( cr.height() );
|
||||
r.setHeight( contentsRect.height() );
|
||||
r.setWidth( m );
|
||||
}
|
||||
|
||||
r.moveCenter( cr.center() );
|
||||
r.moveCenter( contentsRect.center() );
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -26,14 +26,14 @@ class QSK_EXPORT QskSeparatorSkinlet : public QskSkinlet
|
||||
~QskSeparatorSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRectF panelRect( const QskSeparator* ) const;
|
||||
QRectF panelRect( const QskSeparator*, const QRectF& rect ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -57,6 +57,18 @@ static inline QSGNode* qskFindNodeByFlag( QSGNode* parent, int nodeRole )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static inline QRectF qskSubControlRect( const QskSkinlet* skinlet,
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl )
|
||||
{
|
||||
if ( auto control = skinnable->controlCast() )
|
||||
{
|
||||
const auto r = control->contentsRect();
|
||||
return skinlet->subControlRect( skinnable, r, subControl );
|
||||
}
|
||||
|
||||
return QRectF();
|
||||
}
|
||||
|
||||
static inline QSGNode* qskUpdateGraphicNode(
|
||||
const QskSkinnable* skinnable, QSGNode* node,
|
||||
const QskGraphic& graphic, const QskColorFilter& colorFilter,
|
||||
@ -386,7 +398,7 @@ QSGNode* QskSkinlet::findNodeByRole( QSGNode* parent, quint8 nodeRole )
|
||||
QSGNode* QskSkinlet::updateBoxNode( const QskSkinnable* skinnable,
|
||||
QSGNode* node, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const QRectF rect = subControlRect( skinnable, subControl );
|
||||
const QRectF rect = qskSubControlRect( this, skinnable, subControl );
|
||||
return updateBoxNode( skinnable, node, rect, subControl );
|
||||
}
|
||||
|
||||
@ -425,7 +437,7 @@ QSGNode* QskSkinlet::updateBoxNode( const QskSkinnable* skinnable,
|
||||
QSGNode* QskSkinlet::updateBoxClipNode( const QskSkinnable* skinnable,
|
||||
QSGNode* node, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const QRectF rect = subControlRect( skinnable, subControl );
|
||||
const QRectF rect = qskSubControlRect( this, skinnable, subControl );
|
||||
return updateBoxClipNode( skinnable, node, rect, subControl );
|
||||
}
|
||||
|
||||
@ -513,7 +525,7 @@ QSGNode* QskSkinlet::updateTextNode(
|
||||
const QString& text, const QskTextOptions& textOptions,
|
||||
QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const QRectF rect = subControlRect( skinnable, subControl );
|
||||
const QRectF rect = qskSubControlRect( this, skinnable, subControl );
|
||||
const auto alignment = skinnable->flagHint< Qt::Alignment >(
|
||||
QskAspect::Alignment | subControl, Qt::AlignLeft );
|
||||
|
||||
@ -525,7 +537,7 @@ QSGNode* QskSkinlet::updateGraphicNode(
|
||||
const QskSkinnable* skinnable, QSGNode* node,
|
||||
const QskGraphic& graphic, QskAspect::Subcontrol subcontrol ) const
|
||||
{
|
||||
const QRectF rect = subControlRect( skinnable, subcontrol );
|
||||
const QRectF rect = qskSubControlRect( this, skinnable, subcontrol );
|
||||
|
||||
const Qt::Alignment alignment = skinnable->flagHint< Qt::Alignment >(
|
||||
subcontrol | QskAspect::Alignment, Qt::AlignCenter );
|
||||
|
@ -38,7 +38,9 @@ class QSK_EXPORT QskSkinlet
|
||||
QskSkin* skin() const;
|
||||
|
||||
void updateNode( QskSkinnable*, QSGNode* parent ) const;
|
||||
virtual QRectF subControlRect( const QskSkinnable*, QskAspect::Subcontrol ) const;
|
||||
|
||||
virtual QRectF subControlRect(
|
||||
const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const;
|
||||
|
||||
const QVector< quint8 >& nodeRoles() const;
|
||||
|
||||
@ -105,7 +107,7 @@ class QSK_EXPORT QskSkinlet
|
||||
};
|
||||
|
||||
inline QRectF QskSkinlet::subControlRect(
|
||||
const QskSkinnable*, QskAspect::Subcontrol ) const
|
||||
const QskSkinnable*, const QRectF&, QskAspect::Subcontrol ) const
|
||||
{
|
||||
return QRectF();
|
||||
}
|
||||
|
@ -886,11 +886,6 @@ QskAspect::Subcontrol QskSkinnable::effectiveSubcontrol(
|
||||
return subControl;
|
||||
}
|
||||
|
||||
QRectF QskSkinnable::subControlRect( QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
return effectiveSkinlet()->subControlRect( this, subControl );
|
||||
}
|
||||
|
||||
QskControl* QskSkinnable::controlCast()
|
||||
{
|
||||
return qskIsControl( this )
|
||||
|
@ -134,8 +134,6 @@ class QSK_EXPORT QskSkinnable
|
||||
|
||||
QMarginsF innerPadding( QskAspect::Aspect, const QSizeF& ) const;
|
||||
|
||||
QRectF subControlRect( QskAspect::Subcontrol ) const;
|
||||
|
||||
virtual const QskSkinlet* effectiveSkinlet() const;
|
||||
QskSkin* effectiveSkin() const;
|
||||
|
||||
|
@ -25,37 +25,37 @@ QskSliderSkinlet::QskSliderSkinlet( QskSkin* skin )
|
||||
|
||||
QskSliderSkinlet::~QskSliderSkinlet() = default;
|
||||
|
||||
QRectF QskSliderSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskSliderSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto slider = static_cast< const QskSlider* >( skinnable );
|
||||
|
||||
if ( subControl == QskSlider::Panel )
|
||||
{
|
||||
return panelRect( slider );
|
||||
return panelRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskSlider::Groove )
|
||||
{
|
||||
return grooveRect( slider );
|
||||
return grooveRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskSlider::Fill )
|
||||
{
|
||||
return fillRect( slider );
|
||||
return fillRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskSlider::Handle )
|
||||
{
|
||||
return handleRect( slider );
|
||||
return handleRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskSlider::Scale )
|
||||
{
|
||||
return scaleRect( slider );
|
||||
return scaleRect( slider, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskSliderSkinlet::updateSubNode(
|
||||
@ -89,7 +89,8 @@ QSGNode* QskSliderSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::panelRect( const QskSlider* slider ) const
|
||||
QRectF QskSliderSkinlet::panelRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
@ -112,7 +113,7 @@ QRectF QskSliderSkinlet::panelRect( const QskSlider* slider ) const
|
||||
size = qMin( size, maxSize );
|
||||
}
|
||||
|
||||
QRectF r = slider->contentsRect();
|
||||
QRectF r = contentsRect;
|
||||
|
||||
if ( size > 0 && size < r.height() )
|
||||
{
|
||||
@ -128,12 +129,12 @@ QRectF QskSliderSkinlet::panelRect( const QskSlider* slider ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::innerRect(
|
||||
const QskSlider* slider, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskSliderSkinlet::innerRect( const QskSlider* slider,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
QRectF r = subControlRect( slider, QskSlider::Panel );
|
||||
QRectF r = subControlRect( slider, contentsRect, QskSlider::Panel );
|
||||
r = r.marginsRemoved( qskPadding( slider, QskSlider::Panel ) );
|
||||
|
||||
QskSkinHintStatus status;
|
||||
@ -160,27 +161,30 @@ QRectF QskSliderSkinlet::innerRect(
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::grooveRect( const QskSlider* slider ) const
|
||||
QRectF QskSliderSkinlet::grooveRect(
|
||||
const QskSlider* slider, const QRectF& rect ) const
|
||||
{
|
||||
return innerRect( slider, QskSlider::Groove );
|
||||
return innerRect( slider, rect, QskSlider::Groove );
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::scaleRect( const QskSlider* slider ) const
|
||||
QRectF QskSliderSkinlet::scaleRect(
|
||||
const QskSlider* slider, const QRectF& rect ) const
|
||||
{
|
||||
return innerRect( slider, QskSlider::Groove );
|
||||
return innerRect( slider, rect, QskSlider::Groove );
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::fillRect( const QskSlider* slider ) const
|
||||
QRectF QskSliderSkinlet::fillRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
QRectF r = subControlRect( slider, QskSlider::Panel );
|
||||
QRectF r = subControlRect( slider, contentsRect, QskSlider::Panel );
|
||||
r = r.marginsRemoved( qskPadding( slider, QskSlider::Panel ) );
|
||||
|
||||
qreal pos = slider->metric( QskSlider::Handle | Position );
|
||||
pos = qBound( 0.0, pos, 1.0 );
|
||||
|
||||
QRectF fillRect = innerRect( slider, QskSlider::Fill );
|
||||
QRectF fillRect = innerRect( slider, contentsRect, QskSlider::Fill );
|
||||
if ( slider->orientation() == Qt::Horizontal )
|
||||
{
|
||||
fillRect.setLeft( r.left() );
|
||||
@ -195,11 +199,12 @@ QRectF QskSliderSkinlet::fillRect( const QskSlider* slider ) const
|
||||
return fillRect;
|
||||
}
|
||||
|
||||
QRectF QskSliderSkinlet::handleRect( const QskSlider* slider ) const
|
||||
QRectF QskSliderSkinlet::handleRect(
|
||||
const QskSlider* slider, const QRectF& contentsRect ) const
|
||||
{
|
||||
using namespace QskAspect;
|
||||
|
||||
QRectF r = subControlRect( slider, QskSlider::Panel );
|
||||
QRectF r = subControlRect( slider, contentsRect, QskSlider::Panel );
|
||||
r = r.marginsRemoved( qskPadding( slider, QskSlider::Panel ) );
|
||||
|
||||
const bool isHorizontal = slider->orientation() == Qt::Horizontal;
|
||||
|
@ -29,20 +29,20 @@ class QSK_EXPORT QskSliderSkinlet : public QskSkinlet
|
||||
~QskSliderSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRectF panelRect( const QskSlider* ) const;
|
||||
QRectF grooveRect( const QskSlider* ) const;
|
||||
QRectF fillRect( const QskSlider* ) const;
|
||||
QRectF handleRect( const QskSlider* ) const;
|
||||
QRectF scaleRect( const QskSlider* ) const;
|
||||
QRectF panelRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF grooveRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF fillRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF handleRect( const QskSlider*, const QRectF& ) const;
|
||||
QRectF scaleRect( const QskSlider*, const QRectF& ) const;
|
||||
|
||||
QRectF innerRect( const QskSlider*, QskAspect::Subcontrol ) const;
|
||||
QRectF innerRect( const QskSlider*, const QRectF&, QskAspect::Subcontrol ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,17 +19,17 @@ QskStatusIndicatorSkinlet::QskStatusIndicatorSkinlet( QskSkin* skin )
|
||||
|
||||
QskStatusIndicatorSkinlet::~QskStatusIndicatorSkinlet() = default;
|
||||
|
||||
QRectF QskStatusIndicatorSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskStatusIndicatorSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto label = static_cast< const QskStatusIndicator* >( skinnable );
|
||||
|
||||
if ( subControl == QskStatusIndicator::Graphic )
|
||||
{
|
||||
return graphicRect( label );
|
||||
return graphicRect( label, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskStatusIndicatorSkinlet::updateSubNode(
|
||||
@ -49,14 +49,14 @@ QSGNode* QskStatusIndicatorSkinlet::updateSubNode(
|
||||
}
|
||||
|
||||
QRect QskStatusIndicatorSkinlet::graphicRect(
|
||||
const QskStatusIndicator* indicator ) const
|
||||
const QskStatusIndicator* indicator, const QRectF& contentsRect ) const
|
||||
{
|
||||
// maybe we should have a common base class for
|
||||
// QskStatusIndicator and QskGraphicLabel
|
||||
|
||||
// PreserveAspectFit/PreserveAspectCrop
|
||||
|
||||
const QRect graphicRect = indicator->contentsRect().toAlignedRect();
|
||||
const QRect graphicRect = contentsRect.toAlignedRect();
|
||||
|
||||
QSizeF sz = indicator->graphic( indicator->status() ).defaultSize();
|
||||
sz.scale( graphicRect.size(), Qt::KeepAspectRatio );
|
||||
@ -70,7 +70,7 @@ QSGNode* QskStatusIndicatorSkinlet::updateGraphicNode(
|
||||
{
|
||||
const auto subControl = QskStatusIndicator::Graphic;
|
||||
|
||||
const QRectF rect = subControlRect( indicator, subControl );
|
||||
const QRectF rect = subControlRect( indicator, indicator->contentsRect(), subControl );
|
||||
const Qt::Alignment alignment = indicator->flagHint< Qt::Alignment >(
|
||||
subControl | QskAspect::Alignment, Qt::AlignCenter );
|
||||
|
||||
|
@ -26,14 +26,14 @@ class QSK_EXPORT QskStatusIndicatorSkinlet : public QskSkinlet
|
||||
~QskStatusIndicatorSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRect graphicRect( const QskStatusIndicator* ) const;
|
||||
QRect graphicRect( const QskStatusIndicator*, const QRectF& ) const;
|
||||
QSGNode* updateGraphicNode( const QskStatusIndicator*, QSGNode* ) const;
|
||||
};
|
||||
|
||||
|
@ -14,15 +14,13 @@ QskSubWindowAreaSkinlet::QskSubWindowAreaSkinlet( QskSkin* skin )
|
||||
|
||||
QskSubWindowAreaSkinlet::~QskSubWindowAreaSkinlet() = default;
|
||||
|
||||
QRectF QskSubWindowAreaSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskSubWindowAreaSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
||||
|
||||
if ( subControl == QskSubWindowArea::Panel )
|
||||
return area->contentsRect();
|
||||
return contentsRect;
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
|
||||
|
@ -26,7 +26,7 @@ class QSK_EXPORT QskSubWindowAreaSkinlet : public QskSkinlet
|
||||
~QskSubWindowAreaSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -21,29 +21,29 @@ QskSubWindowSkinlet::QskSubWindowSkinlet( QskSkin* skin )
|
||||
|
||||
QskSubWindowSkinlet::~QskSubWindowSkinlet() = default;
|
||||
|
||||
QRectF QskSubWindowSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskSubWindowSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto subWindow = static_cast< const QskSubWindow* >( skinnable );
|
||||
|
||||
if ( subControl == QskSubWindow::Panel )
|
||||
{
|
||||
return subWindow->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
else if ( subControl == QskSubWindow::TitleBar )
|
||||
{
|
||||
return titleBarRect( subWindow );
|
||||
return titleBarRect( subWindow, contentsRect );
|
||||
}
|
||||
else if ( subControl == QskSubWindow::TitleBarSymbol )
|
||||
{
|
||||
return symbolRect( subWindow );
|
||||
return symbolRect( subWindow, contentsRect );
|
||||
}
|
||||
else if ( subControl == QskSubWindow::TitleBarText )
|
||||
{
|
||||
return titleRect( subWindow );
|
||||
return titleRect( subWindow, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskSubWindowSkinlet::updateSubNode(
|
||||
@ -89,14 +89,15 @@ QSGNode* QskSubWindowSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRectF QskSubWindowSkinlet::titleBarRect( const QskSubWindow* subWindow ) const
|
||||
QRectF QskSubWindowSkinlet::titleBarRect(
|
||||
const QskSubWindow* subWindow, const QRectF& contentsRect ) const
|
||||
{
|
||||
const auto border = subWindow->boxBorderMetricsHint( QskSubWindow::Panel );
|
||||
|
||||
QRectF rect = subWindow->contentsRect().marginsRemoved( border.widths() );
|
||||
rect.setHeight( titleBarHeight( subWindow ) );
|
||||
QRectF r = contentsRect.marginsRemoved( border.widths() );
|
||||
r.setHeight( titleBarHeight( subWindow ) );
|
||||
|
||||
return rect;
|
||||
return r;
|
||||
}
|
||||
|
||||
qreal QskSubWindowSkinlet::titleBarHeight( const QskSubWindow* subWindow ) const
|
||||
@ -115,9 +116,10 @@ qreal QskSubWindowSkinlet::titleBarHeight( const QskSubWindow* subWindow ) const
|
||||
return qMax( height, minHeight );
|
||||
}
|
||||
|
||||
QRectF QskSubWindowSkinlet::symbolRect( const QskSubWindow* subWindow ) const
|
||||
QRectF QskSubWindowSkinlet::symbolRect(
|
||||
const QskSubWindow* subWindow, const QRectF& contentsRect ) const
|
||||
{
|
||||
auto rect = subControlRect( subWindow, QskSubWindow::TitleBar );
|
||||
auto rect = subControlRect( subWindow, contentsRect, QskSubWindow::TitleBar );
|
||||
rect = subWindow->innerBox( QskSubWindow::TitleBar, rect );
|
||||
|
||||
int w = 0;
|
||||
@ -134,9 +136,10 @@ QRectF QskSubWindowSkinlet::symbolRect( const QskSubWindow* subWindow ) const
|
||||
return rect;
|
||||
}
|
||||
|
||||
QRectF QskSubWindowSkinlet::titleRect( const QskSubWindow* subWindow ) const
|
||||
QRectF QskSubWindowSkinlet::titleRect(
|
||||
const QskSubWindow* subWindow, const QRectF& contentsRect ) const
|
||||
{
|
||||
auto rect = subControlRect( subWindow, QskSubWindow::TitleBar );
|
||||
auto rect = subControlRect( subWindow, contentsRect, QskSubWindow::TitleBar );
|
||||
rect = subWindow->innerBox( QskSubWindow::TitleBar, rect );
|
||||
|
||||
if ( !rect.isEmpty() )
|
||||
@ -144,7 +147,9 @@ QRectF QskSubWindowSkinlet::titleRect( const QskSubWindow* subWindow ) const
|
||||
const auto spacing = subWindow->metric(
|
||||
QskSubWindow::TitleBar | QskAspect::Spacing );
|
||||
|
||||
const auto symbolRect = subControlRect( subWindow, QskSubWindow::TitleBarSymbol );
|
||||
const auto symbolRect = subControlRect(
|
||||
subWindow, rect, QskSubWindow::TitleBarSymbol );
|
||||
|
||||
rect.setX( rect.x() + symbolRect.right() + spacing );
|
||||
|
||||
#if 0
|
||||
|
@ -29,7 +29,7 @@ class QSK_EXPORT QskSubWindowSkinlet : public QskPopupSkinlet
|
||||
~QskSubWindowSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
@ -38,9 +38,9 @@ class QSK_EXPORT QskSubWindowSkinlet : public QskPopupSkinlet
|
||||
private:
|
||||
qreal titleBarHeight( const QskSubWindow* ) const;
|
||||
|
||||
QRectF titleBarRect( const QskSubWindow* ) const;
|
||||
QRectF symbolRect( const QskSubWindow* ) const;
|
||||
QRectF titleRect( const QskSubWindow* ) const;
|
||||
QRectF titleBarRect( const QskSubWindow*, const QRectF& ) const;
|
||||
QRectF symbolRect( const QskSubWindow*, const QRectF& ) const;
|
||||
QRectF titleRect( const QskSubWindow*, const QRectF& ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -103,7 +103,7 @@ QSizeF QskTabButton::contentsSizeHint() const
|
||||
|
||||
QRectF QskTabButton::layoutRect() const
|
||||
{
|
||||
return innerBox( Panel, effectiveSkinlet()->subControlRect( this, Panel ) );
|
||||
return innerBox( Panel, subControlRect( Panel ) );
|
||||
}
|
||||
|
||||
QskAspect::Placement QskTabButton::effectivePlacement() const
|
||||
|
@ -16,24 +16,24 @@ QskTabButtonSkinlet::QskTabButtonSkinlet( QskSkin* skin )
|
||||
|
||||
QskTabButtonSkinlet::~QskTabButtonSkinlet() = default;
|
||||
|
||||
QRectF QskTabButtonSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskTabButtonSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
auto tabButton = static_cast< const QskTabButton* >( skinnable );
|
||||
|
||||
if ( subControl == QskTabButton::Text )
|
||||
{
|
||||
QRectF rect = subControlRect( tabButton, QskTabButton::Panel );
|
||||
rect = tabButton->innerBox( QskTabButton::Panel, rect );
|
||||
auto r = subControlRect( tabButton, contentsRect, QskTabButton::Panel );
|
||||
r = tabButton->innerBox( QskTabButton::Panel, r );
|
||||
|
||||
return rect;
|
||||
return r;
|
||||
}
|
||||
else if ( subControl == QskTabButton::Panel )
|
||||
{
|
||||
return tabButton->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskTabButtonSkinlet::updateSubNode(
|
||||
|
@ -25,7 +25,7 @@ class QSK_EXPORT QskTabButtonSkinlet : public QskSkinlet
|
||||
~QskTabButtonSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -16,22 +16,22 @@ QskTabViewSkinlet::QskTabViewSkinlet( QskSkin* skin )
|
||||
|
||||
QskTabViewSkinlet::~QskTabViewSkinlet() = default;
|
||||
|
||||
QRectF QskTabViewSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskTabViewSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto tabView = static_cast< const QskTabView* >( skinnable );
|
||||
|
||||
if ( subControl == QskTabView::Page )
|
||||
{
|
||||
return pageRect( tabView );
|
||||
return pageRect( tabView, contentsRect );
|
||||
}
|
||||
|
||||
if ( subControl == QskTabView::TabBar )
|
||||
{
|
||||
return tabBarRect( tabView );
|
||||
return tabBarRect( tabView, contentsRect );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskTabViewSkinlet::updateSubNode(
|
||||
@ -48,9 +48,10 @@ QSGNode* QskTabViewSkinlet::updateSubNode(
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QRectF QskTabViewSkinlet::pageRect( const QskTabView* tabView ) const
|
||||
QRectF QskTabViewSkinlet::pageRect(
|
||||
const QskTabView* tabView, const QRectF& rect ) const
|
||||
{
|
||||
const QRectF barRect = subControlRect( tabView, QskTabView::TabBar );
|
||||
const QRectF barRect = subControlRect( tabView, rect, QskTabView::TabBar );
|
||||
|
||||
#if 1
|
||||
QRectF r = tabView->layoutRect();
|
||||
@ -78,8 +79,11 @@ QRectF QskTabViewSkinlet::pageRect( const QskTabView* tabView ) const
|
||||
return r;
|
||||
}
|
||||
|
||||
QRectF QskTabViewSkinlet::tabBarRect( const QskTabView* tabView ) const
|
||||
QRectF QskTabViewSkinlet::tabBarRect(
|
||||
const QskTabView* tabView, const QRectF& rect ) const
|
||||
{
|
||||
Q_UNUSED( rect )
|
||||
|
||||
const QSizeF hint = tabView->tabBar()->sizeHint();
|
||||
|
||||
#if 1
|
||||
|
@ -26,15 +26,15 @@ class QSK_EXPORT QskTabViewSkinlet : public QskSkinlet
|
||||
~QskTabViewSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
|
||||
private:
|
||||
QRectF pageRect( const QskTabView* ) const;
|
||||
QRectF tabBarRect( const QskTabView* ) const;
|
||||
QRectF pageRect( const QskTabView*, const QRectF& ) const;
|
||||
QRectF tabBarRect( const QskTabView*, const QRectF& ) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,21 +16,20 @@ QskTextInputSkinlet::~QskTextInputSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskTextInputSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskTextInputSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
if ( subControl == QskTextInput::Panel )
|
||||
{
|
||||
const auto textInput = static_cast< const QskTextInput* >( skinnable );
|
||||
return textInput->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
else if ( subControl == QskTextInput::Text )
|
||||
{
|
||||
return skinnable->innerBox( QskTextInput::Panel,
|
||||
subControlRect( skinnable, QskTextInput::Panel ) );
|
||||
const auto r = subControlRect( skinnable, contentsRect, QskTextInput::Panel );
|
||||
return skinnable->innerBox( QskTextInput::Panel, r );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskTextInputSkinlet::updateSubNode(
|
||||
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskTextInputSkinlet : public QskSkinlet
|
||||
~QskTextInputSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
@ -16,17 +16,15 @@ QskTextLabelSkinlet::QskTextLabelSkinlet( QskSkin* skin )
|
||||
|
||||
QskTextLabelSkinlet::~QskTextLabelSkinlet() = default;
|
||||
|
||||
QRectF QskTextLabelSkinlet::subControlRect(
|
||||
const QskSkinnable* skinnable, QskAspect::Subcontrol subControl ) const
|
||||
QRectF QskTextLabelSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
const auto label = static_cast< const QskTextLabel* >( skinnable );
|
||||
|
||||
if ( subControl == QskTextLabel::Text )
|
||||
{
|
||||
return label->contentsRect();
|
||||
return contentsRect;
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskTextLabelSkinlet::updateSubNode(
|
||||
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskTextLabelSkinlet : public QskSkinlet
|
||||
~QskTextLabelSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
QskAspect::Subcontrol ) const override;
|
||||
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
|
Loading…
x
Reference in New Issue
Block a user