Unused splash subcontrol/node removed. As the code was simply copied from the
push button we can restore it easily once we have a sitution, where a splash feedback is required
This commit is contained in:
parent
4f24a74057
commit
afe3248a8b
|
@ -16,7 +16,6 @@ QSK_SUBCONTROL( QskComboBox, Panel )
|
||||||
QSK_SUBCONTROL( QskComboBox, Graphic )
|
QSK_SUBCONTROL( QskComboBox, Graphic )
|
||||||
QSK_SUBCONTROL( QskComboBox, Text )
|
QSK_SUBCONTROL( QskComboBox, Text )
|
||||||
QSK_SUBCONTROL( QskComboBox, PopupIndicator )
|
QSK_SUBCONTROL( QskComboBox, PopupIndicator )
|
||||||
QSK_SUBCONTROL( QskComboBox, Splash )
|
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
QSK_SYSTEM_STATE( QskComboBox, PopupOpen, QskAspect::FirstSystemState << 1 )
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskComboBox : public QskControl
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Graphic, Text, PopupIndicator, Splash )
|
QSK_SUBCONTROLS( Panel, Graphic, Text, PopupIndicator )
|
||||||
QSK_STATES( PopupOpen )
|
QSK_STATES( PopupOpen )
|
||||||
|
|
||||||
QskComboBox( QQuickItem* parent = nullptr );
|
QskComboBox( QQuickItem* parent = nullptr );
|
||||||
|
|
|
@ -66,8 +66,7 @@ namespace
|
||||||
QskComboBoxSkinlet::QskComboBoxSkinlet( QskSkin* skin )
|
QskComboBoxSkinlet::QskComboBoxSkinlet( QskSkin* skin )
|
||||||
: Inherited( skin )
|
: Inherited( skin )
|
||||||
{
|
{
|
||||||
setNodeRoles( { PanelRole, SplashRole,
|
setNodeRoles( { PanelRole, GraphicRole, TextRole, PopupIndicatorRole } );
|
||||||
GraphicRole, TextRole, PopupIndicatorRole } );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskComboBoxSkinlet::~QskComboBoxSkinlet() = default;
|
QskComboBoxSkinlet::~QskComboBoxSkinlet() = default;
|
||||||
|
@ -82,9 +81,6 @@ QRectF QskComboBoxSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
if ( subControl == Q::Panel )
|
if ( subControl == Q::Panel )
|
||||||
return contentsRect;
|
return contentsRect;
|
||||||
|
|
||||||
if ( subControl == Q::Splash )
|
|
||||||
return splashRect( box, contentsRect );
|
|
||||||
|
|
||||||
if ( subControl == Q::Text || subControl == Q::Graphic )
|
if ( subControl == Q::Text || subControl == Q::Graphic )
|
||||||
{
|
{
|
||||||
const auto r = box->subControlContentsRect( contentsRect, Q::Panel );
|
const auto r = box->subControlContentsRect( contentsRect, Q::Panel );
|
||||||
|
@ -131,28 +127,6 @@ QSGNode* QskComboBoxSkinlet::updateSubNode(
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskComboBoxSkinlet::splashRect(
|
|
||||||
const QskComboBox* box, const QRectF& contentsRect ) const
|
|
||||||
{
|
|
||||||
using Q = QskComboBox;
|
|
||||||
|
|
||||||
QRectF rect;
|
|
||||||
|
|
||||||
const auto ratio = box->metric( Q::Splash | QskAspect::Size );
|
|
||||||
if ( ratio > 0.0 )
|
|
||||||
{
|
|
||||||
rect = subControlRect( box, contentsRect, Q::Panel );
|
|
||||||
|
|
||||||
const auto pos = box->positionHint( Q::Splash );
|
|
||||||
const qreal w = 2.0 * rect.width() * ratio;
|
|
||||||
|
|
||||||
rect.setX( pos - 0.5 * w );
|
|
||||||
rect.setWidth( w );
|
|
||||||
}
|
|
||||||
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSGNode* QskComboBoxSkinlet::updateTextNode(
|
QSGNode* QskComboBoxSkinlet::updateTextNode(
|
||||||
const QskComboBox* box, QSGNode* node ) const
|
const QskComboBox* box, QSGNode* node ) const
|
||||||
{
|
{
|
||||||
|
@ -170,34 +144,6 @@ QSGNode* QskComboBoxSkinlet::updateTextNode(
|
||||||
alignment, box->currentText(), Q::Text );
|
alignment, box->currentText(), Q::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskComboBoxSkinlet::updateSplashNode(
|
|
||||||
const QskComboBox* box, QSGNode* node ) const
|
|
||||||
{
|
|
||||||
using Q = QskComboBox;
|
|
||||||
|
|
||||||
const auto splashRect = box->subControlRect( Q::Splash );
|
|
||||||
if ( splashRect.isEmpty() )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto clipNode = updateBoxClipNode( box, node,
|
|
||||||
box->subControlRect( Q::Panel ), Q::Panel );
|
|
||||||
|
|
||||||
if ( clipNode )
|
|
||||||
{
|
|
||||||
auto boxNode = QskSGNode::findChildNode( clipNode, SplashRole );
|
|
||||||
boxNode = updateBoxNode( box, boxNode, splashRect, Q::Splash );
|
|
||||||
|
|
||||||
if ( boxNode == nullptr )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
QskSGNode::setNodeRole( boxNode, SplashRole );
|
|
||||||
if ( boxNode->parent() != clipNode )
|
|
||||||
clipNode->appendChildNode( boxNode );
|
|
||||||
}
|
|
||||||
|
|
||||||
return clipNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSizeF QskComboBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
QSizeF QskComboBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
Qt::SizeHint which, const QSizeF& ) const
|
Qt::SizeHint which, const QSizeF& ) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@ class QSK_EXPORT QskComboBoxSkinlet : public QskSkinlet
|
||||||
GraphicRole,
|
GraphicRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
PopupIndicatorRole,
|
PopupIndicatorRole,
|
||||||
SplashRole,
|
|
||||||
|
|
||||||
RoleCount
|
RoleCount
|
||||||
};
|
};
|
||||||
|
@ -42,10 +41,7 @@ class QSK_EXPORT QskComboBoxSkinlet : public QskSkinlet
|
||||||
quint8 nodeRole, QSGNode* ) const override;
|
quint8 nodeRole, QSGNode* ) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QRectF splashRect( const QskComboBox*, const QRectF& ) const;
|
|
||||||
|
|
||||||
QSGNode* updateTextNode( const QskComboBox*, QSGNode* ) const;
|
QSGNode* updateTextNode( const QskComboBox*, QSGNode* ) const;
|
||||||
QSGNode* updateSplashNode( const QskComboBox*, QSGNode* ) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue