QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskCheckBox.cpp
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#include "QskCheckBox.h"
7
8QSK_SUBCONTROL( QskCheckBox, Panel )
9QSK_SUBCONTROL( QskCheckBox, Box )
10QSK_SUBCONTROL( QskCheckBox, Indicator )
11QSK_SUBCONTROL( QskCheckBox, Text )
12
13QSK_SYSTEM_STATE( QskCheckBox, Error, QskAspect::FirstSystemState << 1 )
14
15class QskCheckBox::PrivateData
16{
17 public:
18 PrivateData( const QString& text )
19 : text( text )
20 {
21 }
22
23 QString text;
24};
25
26QskCheckBox::QskCheckBox( QQuickItem* parent )
27 : QskCheckBox( QString(), parent )
28{
29}
30
31QskCheckBox::QskCheckBox( const QString& text, QQuickItem* parent )
32 : Inherited( parent )
33 , m_data( new PrivateData( text ) )
34{
35 initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
36}
37
38QskCheckBox::~QskCheckBox()
39{
40}
41
42bool QskCheckBox::isCheckable() const
43{
44 return true;
45}
46
47void QskCheckBox::setText( const QString& text )
48{
49 if ( text != m_data->text )
50 {
51 m_data->text = text;
52
54 update();
55
56 Q_EMIT textChanged();
57 }
58}
59
60QString QskCheckBox::text() const
61{
62 return m_data->text;
63}
64
65void QskCheckBox::changeEvent( QEvent* event )
66{
67 if ( event->type() == QEvent::LayoutDirectionChange )
68 {
69 if ( !m_data->text.isEmpty() )
70 update();
71 }
72
74}
75
76#include "moc_QskCheckBox.cpp"
@ FirstSystemState
Definition QskAspect.h:115
void changeEvent(QEvent *) override
void resetImplicitSize()
Definition QskItem.cpp:721
virtual void changeEvent(QEvent *)
Definition QskItem.cpp:859