harmonizing skinlet code

This commit is contained in:
Uwe Rathmann 2017-09-01 11:55:55 +02:00
parent be146f2480
commit 16585a708d
25 changed files with 248 additions and 290 deletions

View File

@ -34,11 +34,12 @@ QSGNode* QskBoxSkinlet::updateSubNode(
switch( nodeRole )
{
case PanelRole:
{
return updateBoxNode( skinnable, node, QskBox::Panel );
default:
return nullptr;
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
#include "moc_QskBoxSkinlet.cpp"

View File

@ -23,17 +23,12 @@ QRectF QskFocusIndicatorSkinlet::subControlRect(
if ( subControl == QskFocusIndicator::Panel )
{
return panelRect( indicator );
return indicator->boundingRect();
}
return Inherited::subControlRect( skinnable, subControl );
}
QRectF QskFocusIndicatorSkinlet::panelRect( const QskFocusIndicator* indicator ) const
{
return indicator->boundingRect();
}
QSGNode* QskFocusIndicatorSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
@ -42,11 +37,12 @@ QSGNode* QskFocusIndicatorSkinlet::updateSubNode(
switch( nodeRole )
{
case FrameRole:
{
return updateFrameNode( indicator, node );
default:
return nullptr;
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QSGNode* QskFocusIndicatorSkinlet::updateFrameNode(

View File

@ -34,7 +34,6 @@ protected:
quint8 nodeRole, QSGNode* ) const override;
private:
QRectF panelRect( const QskFocusIndicator* ) const;
QSGNode* updateFrameNode( const QskFocusIndicator*, QSGNode* ) const;
};

View File

@ -33,6 +33,22 @@ QRectF QskGraphicLabelSkinlet::subControlRect(
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskGraphicLabelSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto label = static_cast< const QskGraphicLabel* >( skinnable );
switch( nodeRole )
{
case GraphicRole:
{
return updateGraphicNode( label, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRect QskGraphicLabelSkinlet::graphicRect( const QskGraphicLabel* label ) const
{
// textures are in integers, to avoid useless recalculations
@ -62,21 +78,6 @@ QRect QskGraphicLabelSkinlet::graphicRect( const QskGraphicLabel* label ) const
( int )sz.width(), ( int )sz.height(), label->alignment() );
}
QSGNode* QskGraphicLabelSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto label = static_cast< const QskGraphicLabel* >( skinnable );
switch( nodeRole )
{
case GraphicRole:
return updateGraphicNode( label, node );
default:
return nullptr;
}
}
QSGNode* QskGraphicLabelSkinlet::updateGraphicNode(
const QskGraphicLabel* label, QSGNode* node ) const
{

View File

@ -30,6 +30,27 @@ QRectF QskPageIndicatorSkinlet::subControlRect(
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskPageIndicatorSkinlet::updateSubNode( const QskSkinnable* skinnable,
quint8 nodeRole, QSGNode* node ) const
{
const auto indicator = static_cast< const QskPageIndicator* >( skinnable );
switch( nodeRole )
{
case PanelRole:
{
return updateBoxNode( indicator, node, QskPageIndicator::Panel );
}
case BulletsRole:
{
return updateBulletsNode( indicator, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRectF QskPageIndicatorSkinlet::bulletRect(
const QskPageIndicator* indicator, const QRectF& rect, int index ) const
{
@ -108,30 +129,6 @@ QRectF QskPageIndicatorSkinlet::bulletRect(
return ret;
}
QSGNode* QskPageIndicatorSkinlet::updateSubNode( const QskSkinnable* skinnable,
quint8 nodeRole, QSGNode* node ) const
{
const auto indicator = static_cast< const QskPageIndicator* >( skinnable );
switch( nodeRole )
{
case PanelRole:
return updatePanelNode( indicator, node );
case BulletsRole:
return updateBulletsNode( indicator, node );
default:
return nullptr;
}
}
QSGNode* QskPageIndicatorSkinlet::updatePanelNode(
const QskPageIndicator* indicator, QSGNode* node ) const
{
return updateBoxNode( indicator, node, QskPageIndicator::Panel );
}
QSGNode* QskPageIndicatorSkinlet::updateBulletsNode(
const QskPageIndicator* indicator, QSGNode* node) const
{

View File

@ -35,9 +35,7 @@ protected:
quint8 nodeRole, QSGNode* ) const override;
private:
QSGNode* updatePanelNode( const QskPageIndicator*, QSGNode* ) const;
QSGNode* updateBulletsNode( const QskPageIndicator*, QSGNode* ) const;
QRectF bulletRect( const QskPageIndicator*, const QRectF&, int index ) const;
};

View File

@ -34,11 +34,12 @@ QSGNode* QskPopupSkinlet::updateSubNode( const QskSkinnable* skinnable,
switch( nodeRole )
{
case OverlayRole:
{
return updateOverlayNode( popup, node );
default:
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QSGNode* QskPopupSkinlet::updateOverlayNode(

View File

@ -14,7 +14,7 @@
QskPushButtonSkinlet::QskPushButtonSkinlet( QskSkin* skin ):
Inherited( skin )
{
setNodeRoles( { ButtonRole, GraphicRole, TextRole } );
setNodeRoles( { PanelRole, GraphicRole, TextRole } );
}
QskPushButtonSkinlet::~QskPushButtonSkinlet() = default;
@ -40,12 +40,39 @@ QRectF QskPushButtonSkinlet::subControlRect(
}
else if ( subControl == QskPushButton::Panel )
{
return panelRect( button );
return button->contentsRect();
}
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskPushButtonSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto button = static_cast< const QskPushButton* >( skinnable );
switch( nodeRole )
{
case PanelRole:
{
return updateBoxNode( button, node, QskPushButton::Panel );
}
case TextRole:
{
return updateTextNode( button, node );
}
case GraphicRole:
{
return updateGraphicNode( button, node,
button->graphic(), QskPushButton::Graphic );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRectF QskPushButtonSkinlet::textRect( const QskPushButton* button ) const
{
// buttonShift -> TODO
@ -97,38 +124,6 @@ QRectF QskPushButtonSkinlet::graphicRect( const QskPushButton* button ) const
return QRectF( x, y, w, h );
}
QRectF QskPushButtonSkinlet::panelRect( const QskPushButton* button ) const
{
return button->contentsRect();
}
QSGNode* QskPushButtonSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto button = static_cast< const QskPushButton* >( skinnable );
switch( nodeRole )
{
case ButtonRole:
return updateButtonNode( button, node );
case TextRole:
return updateTextNode( button, node );
case GraphicRole:
return updateGraphicNode( button, node );
default:
return nullptr;
}
}
QSGNode* QskPushButtonSkinlet::updateButtonNode(
const QskPushButton* button, QSGNode* node ) const
{
return updateBoxNode( button, node, QskPushButton::Panel );
}
QSGNode* QskPushButtonSkinlet::updateTextNode(
const QskPushButton* button, QSGNode* node ) const
{
@ -145,11 +140,4 @@ QSGNode* QskPushButtonSkinlet::updateTextNode(
button->text(), button->textOptions(), QskPushButton::Text );
}
QSGNode* QskPushButtonSkinlet::updateGraphicNode(
const QskPushButton* button, QSGNode* node ) const
{
return QskSkinlet::updateGraphicNode( button, node,
button->graphic(), QskPushButton::Graphic );
}
#include "moc_QskPushButtonSkinlet.cpp"

View File

@ -20,7 +20,7 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
public:
enum NodeRole
{
ButtonRole,
PanelRole,
TextRole,
GraphicRole
};
@ -38,13 +38,10 @@ protected:
quint8 nodeRole, QSGNode* ) const override;
private:
QRectF panelRect( const QskPushButton* ) const;
QRectF textRect( const QskPushButton* ) const;
QRectF graphicRect( const QskPushButton* ) const;
QSGNode* updateButtonNode( const QskPushButton*, QSGNode* ) const;
QSGNode* updateTextNode( const QskPushButton*, QSGNode* ) const;
QSGNode* updateGraphicNode( const QskPushButton*, QSGNode* ) const;
};
#endif

View File

@ -54,22 +54,34 @@ QRectF QskScrollViewSkinlet::subControlRect(
const auto scrollView = static_cast< const QskScrollView* >( skinnable );
if ( subControl == QskScrollView::Panel )
{
return scrollView->contentsRect();
}
if ( subControl == QskScrollView::Viewport )
{
return viewportRect( scrollView );
}
if ( subControl == QskScrollView::HorizontalScrollBar )
{
return scrollBarRect( scrollView, Qt::Horizontal );
}
if ( subControl == QskScrollView::HorizontalScrollHandle )
{
return scrollHandleRect( scrollView, Qt::Horizontal );
}
if ( subControl == QskScrollView::VerticalScrollBar )
{
return scrollBarRect( scrollView, Qt::Vertical );
}
if ( subControl == QskScrollView::VerticalScrollHandle )
{
return scrollHandleRect( scrollView, Qt::Vertical );
}
return Inherited::subControlRect( skinnable, subControl );
}
@ -82,20 +94,30 @@ QSGNode* QskScrollViewSkinlet::updateSubNode(
switch( nodeRole )
{
case ViewportRole:
{
return updateViewportNode( scrollView, node );
}
case HorizontalScrollHandleRole:
{
return updateBoxNode( skinnable, node, QskScrollView::HorizontalScrollHandle );
}
case VerticalScrollHandleRole:
{
return updateBoxNode( skinnable, node, QskScrollView::VerticalScrollHandle );
}
case ContentsRootRole:
{
return updateContentsRootNode( scrollView, node );
}
case HorizontalScrollBarRole:
case VerticalScrollBarRole:
{
return nullptr;
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );

View File

@ -26,7 +26,27 @@ QRectF QskSeparatorSkinlet::subControlRect(
}
return Inherited::subControlRect( skinnable, subControl );
}
}
QSGNode* QskSeparatorSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto separator = static_cast< const QskSeparator* >( skinnable );
switch( nodeRole )
{
case PanelRole:
{
const bool isHorizontal = ( separator->orientation() == Qt::Horizontal );
const QRectF r = subControlRect( separator, QskSeparator::Panel );
return updateBoxNode( separator, node, r,
QskSeparator::Panel, isHorizontal ? 0 : -1 );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRectF QskSeparatorSkinlet::panelRect( const QskSeparator* separator ) const
{
@ -50,29 +70,4 @@ QRectF QskSeparatorSkinlet::panelRect( const QskSeparator* separator ) const
return r;
}
QSGNode* QskSeparatorSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto separator = static_cast< const QskSeparator* >( skinnable );
switch( nodeRole )
{
case PanelRole:
return updatePanelNode( separator, node );
default:
return nullptr;
}
}
QSGNode* QskSeparatorSkinlet::updatePanelNode(
const QskSeparator* separator, QSGNode* node ) const
{
const bool isHorizontal = ( separator->orientation() == Qt::Horizontal );
const QRectF r = subControlRect( separator, QskSeparator::Panel );
return updateBoxNode( separator, node, r,
QskSeparator::Panel, isHorizontal ? 0 : -1 );
}
#include "moc_QskSeparatorSkinlet.cpp"

View File

@ -35,7 +35,6 @@ protected:
private:
QRectF panelRect( const QskSeparator* ) const;
QSGNode* updatePanelNode( const QskSeparator*, QSGNode* ) const;
};
#endif

View File

@ -132,11 +132,6 @@ const QVector< quint8 >& QskSkinlet::nodeRoles() const
return m_data->nodeRoles;
}
QRectF QskSkinlet::subControlRect( const QskSkinnable*, QskAspect::Subcontrol ) const
{
return QRectF();
}
void QskSkinlet::updateNode( QskSkinnable* skinnable, QSGNode* parentNode ) const
{
QSGNode* oldNode;
@ -178,12 +173,6 @@ void QskSkinlet::updateNode( QskSkinnable* skinnable, QSGNode* parentNode ) cons
}
}
QSGNode* QskSkinlet::updateSubNode(
const QskSkinnable*, quint8, QSGNode*) const
{
return nullptr;
}
QSGNode* QskSkinlet::updateBackgroundNode(
const QskControl* control, QSGNode* node ) const
{

View File

@ -10,6 +10,7 @@
#include "QskAspect.h"
#include <Qt>
#include <QRectF>
#include <memory>
class QskSkin;
@ -99,4 +100,16 @@ private:
std::unique_ptr< PrivateData > m_data;
};
inline QRectF QskSkinlet::subControlRect(
const QskSkinnable*, QskAspect::Subcontrol ) const
{
return QRectF();
}
inline QSGNode* QskSkinlet::updateSubNode(
const QskSkinnable*, quint8, QSGNode*) const
{
return nullptr;
}
#endif

View File

@ -49,23 +49,64 @@ QRectF QskSliderSkinlet::subControlRect(
const auto slider = static_cast< const QskSlider* >( skinnable );
if ( subControl == QskSlider::Panel )
{
return panelRect( slider );
}
if ( subControl == QskSlider::Groove )
{
return grooveRect( slider );
}
if ( subControl == QskSlider::Fill )
{
return fillRect( slider );
}
if ( subControl == QskSlider::Handle )
{
return handleRect( slider );
}
if ( subControl == QskSlider::Scale )
{
return scaleRect( slider );
}
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskSliderSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto slider = static_cast< const QskSlider* >( skinnable );
switch( nodeRole )
{
case PanelRole:
{
return updateBoxNode( slider, QskSlider::Panel, node );
}
case GrooveRole:
{
return updateBoxNode( slider, QskSlider::Groove, node );
}
case FillRole:
{
return updateBoxNode( slider, QskSlider::Fill, node );
}
case HandleRole:
{
return updateBoxNode( slider, QskSlider::Handle, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRectF QskSliderSkinlet::panelRect( const QskSlider* slider ) const
{
using namespace QskAspect;
@ -212,30 +253,6 @@ QRectF QskSliderSkinlet::handleRect( const QskSlider* slider ) const
return handleRect;
}
QSGNode* QskSliderSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto slider = static_cast< const QskSlider* >( skinnable );
switch( nodeRole )
{
case PanelRole:
return updateBoxNode( slider, QskSlider::Panel, node );
case GrooveRole:
return updateBoxNode( slider, QskSlider::Groove, node );
case FillRole:
return updateBoxNode( slider, QskSlider::Fill, node );
case HandleRole:
return updateBoxNode( slider, QskSlider::Handle, node );
default:
return nullptr;
}
}
QSGNode* QskSliderSkinlet::updateBoxNode( const QskSlider* slider,
QskAspect::Subcontrol subControl, QSGNode* node ) const
{

View File

@ -33,6 +33,22 @@ QRectF QskStatusIndicatorSkinlet::subControlRect(
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskStatusIndicatorSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto indicator = static_cast< const QskStatusIndicator* >( skinnable );
switch( nodeRole )
{
case GraphicRole:
{
return updateGraphicNode( indicator, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRect QskStatusIndicatorSkinlet::graphicRect(
const QskStatusIndicator* indicator ) const
{
@ -50,21 +66,6 @@ QRect QskStatusIndicatorSkinlet::graphicRect(
( int )sz.width(), ( int )sz.height(), Qt::AlignCenter );
}
QSGNode* QskStatusIndicatorSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto indicator = static_cast< const QskStatusIndicator* >( skinnable );
switch( nodeRole )
{
case GraphicRole:
return updateGraphicNode( indicator, node );
default:
return nullptr;
}
}
QSGNode* QskStatusIndicatorSkinlet::updateGraphicNode(
const QskStatusIndicator* indicator, QSGNode* node ) const
{

View File

@ -5,7 +5,6 @@
#include "QskSubWindowAreaSkinlet.h"
#include "QskSubWindowArea.h"
#include "QskSkin.h"
#include "QskGradient.h"
#include "QskRectNode.h"
@ -24,17 +23,12 @@ QRectF QskSubWindowAreaSkinlet::subControlRect(
if ( subControl == QskSubWindowArea::Panel )
{
return panelRect( area );
return area->contentsRect();
}
return Inherited::subControlRect( skinnable, subControl );
}
QRectF QskSubWindowAreaSkinlet::panelRect( const QskSubWindowArea* area ) const
{
return area->contentsRect();
}
QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
@ -43,11 +37,12 @@ QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
switch( nodeRole )
{
case PanelRole:
{
return updatePanelNode( area, node );
default:
return nullptr;
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QSGNode* QskSubWindowAreaSkinlet::updatePanelNode(

View File

@ -34,7 +34,6 @@ protected:
quint8 nodeRole, QSGNode* ) const override;
private:
QRectF panelRect( const QskSubWindowArea* ) const;
QSGNode* updatePanelNode( const QskSubWindowArea*, QSGNode* ) const;
};

View File

@ -53,14 +53,17 @@ QSGNode* QskSubWindowSkinlet::updateSubNode( const QskSkinnable* skinnable,
switch( nodeRole )
{
case PanelRole:
{
return updatePanelNode( subWindow, node );
}
case TitleBarRole:
{
return updateTitleBarNode( subWindow, node );
default:
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QSGNode* QskSubWindowSkinlet::updatePanelNode(

View File

@ -13,7 +13,7 @@
QskTabButtonSkinlet::QskTabButtonSkinlet( QskSkin* skin ):
Inherited( skin )
{
setNodeRoles( { ButtonRole, TextRole } );
setNodeRoles( { PanelRole, TextRole } );
}
QskTabButtonSkinlet::~QskTabButtonSkinlet() = default;
@ -25,33 +25,19 @@ QRectF QskTabButtonSkinlet::subControlRect(
if ( subControl == QskTabButton::Text )
{
return textRect( tabButton );
QRectF rect = subControlRect( tabButton, QskTabButton::Panel );
rect = tabButton->innerBox( QskTabButton::Panel, rect );
return rect;
}
else if ( subControl == QskTabButton::Panel )
{
return panelRect( tabButton );
return tabButton->contentsRect();
}
return Inherited::subControlRect( skinnable, subControl );
}
QRectF QskTabButtonSkinlet::textRect( const QskTabButton* tabButton ) const
{
QRectF rect = subControlRect( tabButton, QskTabButton::Panel );
#if 1
// the margins might depend on the state ???
rect = tabButton->innerBox( QskTabButton::Panel, rect );
#endif
return rect;
}
QRectF QskTabButtonSkinlet::panelRect( const QskTabButton* tabButton ) const
{
return tabButton->contentsRect();
}
QSGNode* QskTabButtonSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
@ -59,32 +45,23 @@ QSGNode* QskTabButtonSkinlet::updateSubNode(
switch( nodeRole )
{
case ButtonRole:
return updateButtonNode( tabButton, node );
case PanelRole:
{
const auto tabBar = tabButton->tabBar();
const Qt::Orientation o = tabBar ? tabBar->orientation() : Qt::Horizontal;
return updateBoxNode( tabButton, node, tabButton->contentsRect(),
QskTabButton::Panel, ( o == Qt::Vertical ) ? 1 : 0 );
}
case TextRole:
return updateTextNode( tabButton, node );
default:
return nullptr;
{
return updateTextNode( tabButton, node, tabButton->text(),
tabButton->textOptions(), QskTabButton::Text );
}
}
}
QSGNode* QskTabButtonSkinlet::updateButtonNode(
const QskTabButton* tabButton, QSGNode* node ) const
{
const auto tabBar = tabButton->tabBar();
const Qt::Orientation o = tabBar ? tabBar->orientation() : Qt::Horizontal;
return updateBoxNode( tabButton, node, tabButton->contentsRect(),
QskTabButton::Panel, ( o == Qt::Vertical ) ? 1 : 0 );
}
QSGNode* QskTabButtonSkinlet::updateTextNode(
const QskTabButton* tabButton, QSGNode* node ) const
{
return QskSkinlet::updateTextNode( tabButton, node, tabButton->text(),
tabButton->textOptions(), QskTabButton::Text );
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
#include "moc_QskTabButtonSkinlet.cpp"

View File

@ -9,8 +9,6 @@
#include "QskGlobal.h"
#include "QskSkinlet.h"
class QskTabButton;
class QSK_EXPORT QskTabButtonSkinlet : public QskSkinlet
{
Q_GADGET
@ -20,7 +18,7 @@ class QSK_EXPORT QskTabButtonSkinlet : public QskSkinlet
public:
enum NodeRole
{
ButtonRole,
PanelRole,
TextRole
};
@ -33,13 +31,6 @@ public:
protected:
virtual QSGNode* updateSubNode(
const QskSkinnable*, quint8 nodeRole, QSGNode* ) const override;
private:
QRectF textRect( const QskTabButton* ) const;
QRectF panelRect( const QskTabButton* ) const;
QSGNode* updateButtonNode( const QskTabButton*, QSGNode* ) const;
QSGNode* updateTextNode( const QskTabButton*, QSGNode* ) const;
};
#endif

View File

@ -21,14 +21,32 @@ QRectF QskTabViewSkinlet::subControlRect(
const auto tabView = static_cast< const QskTabView* >( skinnable );
if ( subControl == QskTabView::Page )
{
return pageRect( tabView );
}
if ( subControl == QskTabView::TabBar )
{
return tabBarRect( tabView );
}
return Inherited::subControlRect( skinnable, subControl );
}
QSGNode* QskTabViewSkinlet::updateSubNode( const QskSkinnable* skinnable,
quint8 nodeRole, QSGNode* node ) const
{
switch( nodeRole )
{
case PageRole:
{
return updateBoxNode( skinnable, node, QskTabView::Page );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
QRectF QskTabViewSkinlet::pageRect( const QskTabView* tabView ) const
{
const QRectF barRect = subControlRect( tabView, QskTabView::TabBar );
@ -70,25 +88,4 @@ QRectF QskTabViewSkinlet::tabBarRect( const QskTabView* tabView ) const
return r;
}
QSGNode* QskTabViewSkinlet::updateSubNode( const QskSkinnable* skinnable,
quint8 nodeRole, QSGNode* node ) const
{
const auto tabView = static_cast< const QskTabView* >( skinnable );
switch( nodeRole )
{
case PageRole:
return updatePageNode( tabView, node );
default:
return nullptr;
}
}
QSGNode* QskTabViewSkinlet::updatePageNode(
const QskTabView* tabView, QSGNode* node ) const
{
return updateBoxNode( tabView, node, QskTabView::Page );
}
#include "moc_QskTabViewSkinlet.cpp"

View File

@ -36,8 +36,6 @@ protected:
private:
QRectF pageRect( const QskTabView* ) const;
QRectF tabBarRect( const QskTabView* ) const;
QSGNode* updatePageNode( const QskTabView*, QSGNode* ) const;
};
#endif

View File

@ -22,17 +22,12 @@ QRectF QskTextLabelSkinlet::subControlRect(
if ( subControl == QskTextLabel::Text )
{
return textRect( label );
return label->contentsRect();
}
return Inherited::subControlRect( skinnable, subControl );
}
QRectF QskTextLabelSkinlet::textRect( const QskTextLabel* label ) const
{
return label->contentsRect();
}
QSGNode* QskTextLabelSkinlet::updateSubNode( const QskSkinnable* skinnable,
quint8 nodeRole, QSGNode* node ) const
{
@ -41,18 +36,13 @@ QSGNode* QskTextLabelSkinlet::updateSubNode( const QskSkinnable* skinnable,
switch( nodeRole )
{
case TextRole:
return updateTextNode( label, node );
default:
return nullptr;
{
return updateTextNode( label, node,
label->text(), label->textOptions(), QskTextLabel::Text );
}
}
}
QSGNode* QskTextLabelSkinlet::updateTextNode(
const QskTextLabel* label, QSGNode* node ) const
{
return QskSkinlet::updateTextNode( label, node,
label->text(), label->textOptions(), QskTextLabel::Text );
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
#include "moc_QskTextLabelSkinlet.cpp"

View File

@ -9,8 +9,6 @@
#include "QskGlobal.h"
#include "QskSkinlet.h"
class QskTextLabel;
class QSK_EXPORT QskTextLabelSkinlet : public QskSkinlet
{
Q_GADGET
@ -32,10 +30,6 @@ public:
protected:
virtual QSGNode* updateSubNode( const QskSkinnable*,
quint8 nodeRole, QSGNode* ) const override;
private:
QRectF textRect( const QskTextLabel* ) const;
QSGNode* updateTextNode( const QskTextLabel*, QSGNode* ) const;
};
#endif