QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskPushButton.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_PUSH_BUTTON_H
7#define QSK_PUSH_BUTTON_H
8
9#include "QskAbstractButton.h"
10
12class QskGraphic;
13class QskTextOptions;
14
15class QSK_EXPORT QskPushButton : public QskAbstractButton
16{
17 Q_OBJECT
18
19 Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged FINAL )
20
21 Q_PROPERTY( QFont font READ font )
22
23 Q_PROPERTY( QskTextOptions textOptions READ textOptions
24 WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
25
26 Q_PROPERTY( QUrl iconSource READ iconSource
27 WRITE setIconSource NOTIFY iconSourceChanged FINAL )
28
29 Q_PROPERTY( QskGraphic icon READ icon
30 WRITE setIcon NOTIFY iconChanged FINAL )
31
32 Q_PROPERTY( QSizeF iconStrutSize READ iconStrutSize
33 WRITE setIconStrutSize RESET resetIconStrutSize
34 NOTIFY iconStrutSizeChanged FINAL )
35
36 Q_PROPERTY( bool checkable READ isCheckable
37 WRITE setCheckable NOTIFY checkableChanged FINAL )
38
39 Q_PROPERTY( Emphasis emphasis READ emphasis
40 WRITE setEmphasis NOTIFY emphasisChanged )
41
42 Q_PROPERTY( QskBoxShapeMetrics shape READ shape
43 WRITE setShape RESET resetShape NOTIFY shapeChanged )
44
46
47 public:
48 QSK_SUBCONTROLS( Panel, Splash, Text, Icon )
49
50 enum Emphasis
51 {
52 VeryLowEmphasis = -2,
53 LowEmphasis = -1,
54 NoEmphasis = 0,
55 HighEmphasis = 1,
56 VeryHighEmphasis = 2
57 };
58 Q_ENUM( Emphasis )
59
60 QskPushButton( QQuickItem* parent = nullptr );
61 QskPushButton( const QString& text, QQuickItem* parent = nullptr );
62
63 ~QskPushButton() override;
64
65 void setEmphasis( Emphasis );
66 Emphasis emphasis() const;
67
68 void setCheckable( bool );
69 bool isCheckable() const override final;
70
71 void setShape( const QskBoxShapeMetrics& );
72 QskBoxShapeMetrics shape() const;
73 void resetShape();
74
75 QString text() const;
76
77 void setTextOptions( const QskTextOptions& );
78 QskTextOptions textOptions() const;
79 void resetTextOptions();
80
81 void setIconStrutSize( const QSizeF& );
82 QSizeF iconStrutSize() const;
83 void resetIconStrutSize();
84
85 QUrl iconSource() const;
86 QskGraphic icon() const;
87 bool hasIcon() const;
88
89 QFont font() const;
90
91 QRectF layoutRectForSize( const QSizeF& ) const override;
93
94 public Q_SLOTS:
95 void setText( const QString& );
96 void setIconSource( const QUrl& );
97 void setIconSource( const QString& );
98 void setIcon( const QskGraphic& );
99
100 Q_SIGNALS:
101 void checkableChanged( bool );
102 void emphasisChanged( Emphasis ) const;
103 void shapeChanged();
104
105 void textChanged();
106 void textOptionsChanged();
107
108 void iconChanged();
109 void iconSourceChanged();
110 void iconStrutSizeChanged();
111
112 protected:
113 void changeEvent( QEvent* ) override;
114 void mousePressEvent( QMouseEvent* ) override;
115
116 void updateResources() override;
117 virtual QskGraphic loadIcon( const QUrl& ) const;
118
119 private:
120 class PrivateData;
121 std::unique_ptr< PrivateData > m_data;
122};
123
124#endif
Variation
Some sort of variation.
Definition QskAspect.h:82
virtual QRectF layoutRectForSize(const QSizeF &) const
A paint device for scalable graphics.
Definition QskGraphic.h:28
virtual void changeEvent(QEvent *)
Definition QskItem.cpp:859
virtual QskAspect::Variation effectiveVariation() const