QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskTextInputSkinlet.cpp
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#include "QskTextInputSkinlet.h"
7#include "QskTextInput.h"
8
9QskTextInputSkinlet::QskTextInputSkinlet( QskSkin* skin )
10 : Inherited( skin )
11{
12 setNodeRoles( { PanelRole } );
13}
14
15QskTextInputSkinlet::~QskTextInputSkinlet()
16{
17}
18
19QRectF QskTextInputSkinlet::subControlRect( const QskSkinnable* skinnable,
20 const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
21{
22 if ( subControl == QskTextInput::Panel )
23 {
24 return contentsRect;
25 }
26 else if ( subControl == QskTextInput::Text )
27 {
28 return skinnable->subControlContentsRect( contentsRect, QskTextInput::Panel );
29 }
30
31 return Inherited::subControlRect( skinnable, contentsRect, subControl );
32}
33
34QSGNode* QskTextInputSkinlet::updateSubNode(
35 const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
36{
37 switch ( nodeRole )
38 {
39 case PanelRole:
40 {
41 const auto input = static_cast< const QskTextInput* >( skinnable );
42 if ( !input->hasPanel() )
43 return nullptr;
44
45 return updateBoxNode( skinnable, node, QskTextInput::Panel );
46 }
47 }
48
49 return Inherited::updateSubNode( skinnable, nodeRole, node );
50}
51
52#include "moc_QskTextInputSkinlet.cpp"
Subcontrol
For use within the rendering or lay-outing of a specific QskSkinnable.
Definition QskAspect.h:104
QRectF subControlContentsRect(const QRectF &, QskAspect::Subcontrol) const
Calculate the inner rectangle for subControl.