qskinny/src/controls/QskTextLabelSkinlet.cpp
2019-04-25 14:23:39 +02:00

48 lines
1.3 KiB
C++

/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#include "QskTextLabelSkinlet.h"
#include "QskTextLabel.h"
#include "QskTextOptions.h"
QskTextLabelSkinlet::QskTextLabelSkinlet( QskSkin* skin )
: Inherited( skin )
{
setNodeRoles( { TextRole } );
}
QskTextLabelSkinlet::~QskTextLabelSkinlet() = default;
QRectF QskTextLabelSkinlet::subControlRect( const QskSkinnable* skinnable,
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
{
if ( subControl == QskTextLabel::Text )
{
return contentsRect;
}
return Inherited::subControlRect( skinnable, contentsRect, subControl );
}
QSGNode* QskTextLabelSkinlet::updateSubNode(
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
{
const auto label = static_cast< const QskTextLabel* >( skinnable );
switch ( nodeRole )
{
case TextRole:
{
return updateTextNode( label, node,
label->text(), label->textOptions(), QskTextLabel::Text );
}
}
return Inherited::updateSubNode( skinnable, nodeRole, node );
}
#include "moc_QskTextLabelSkinlet.cpp"