QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskTextLabel.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_TEXT_LABEL_H
7#define QSK_TEXT_LABEL_H
8
9#include "QskControl.h"
10#include "QskTextOptions.h"
11
12class QskFontRole;
13
14class QSK_EXPORT QskTextLabel : public QskControl
15{
16 Q_OBJECT
17
18 Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged USER true )
19
20 Q_PROPERTY( QskFontRole fontRole READ fontRole
21 WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged )
22
23 Q_PROPERTY( QFont font READ font )
24
25 Q_PROPERTY( QColor textColor READ textColor
26 WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged )
27
28 Q_PROPERTY( QskTextOptions textOptions READ textOptions
29 WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
30
31 Q_PROPERTY( Qt::Alignment alignment READ alignment
32 WRITE setAlignment NOTIFY alignmentChanged )
33
34 Q_PROPERTY( bool panel READ hasPanel
35 WRITE setPanel NOTIFY panelChanged )
36
37 using Inherited = QskControl;
38
39 public:
40 QSK_SUBCONTROLS( Panel, Text )
41
42 QskTextLabel( QQuickItem* parent = nullptr );
43 QskTextLabel( const QString& text, QQuickItem* parent = nullptr );
44
45 ~QskTextLabel() override;
46
47 QString text() const;
48
49 void setFontRole( const QskFontRole& );
50 void resetFontRole();
51 QskFontRole fontRole() const;
52
53 void setTextColor( const QColor& );
54 void resetTextColor();
55 QColor textColor() const;
56
57 void setTextOptions( const QskTextOptions& );
58 QskTextOptions textOptions() const;
59 void resetTextOptions();
60
61 void setTextFormat( QskTextOptions::TextFormat );
62 QskTextOptions::TextFormat textFormat() const;
63
64 QskTextOptions::TextFormat effectiveTextFormat() const;
65
66 void setWrapMode( QskTextOptions::WrapMode );
67 QskTextOptions::WrapMode wrapMode() const;
68
69 void setElideMode( Qt::TextElideMode );
70 Qt::TextElideMode elideMode() const;
71
72 void setAlignment( Qt::Alignment );
73 void resetAlignment();
74 Qt::Alignment alignment() const;
75
76 QFont font() const;
77
78 void setPanel( bool );
79 bool hasPanel() const;
80
81 Q_SIGNALS:
82 void textChanged( const QString& );
83 void textColorChanged( const QColor& );
84 void textOptionsChanged( const QskTextOptions& );
85 void fontRoleChanged( const QskFontRole& );
86 void alignmentChanged( Qt::Alignment );
87 void panelChanged( bool );
88
89 public Q_SLOTS:
90 void setText( const QString& );
91
92 protected:
93 void changeEvent( QEvent* ) override;
94
95 private:
96 class PrivateData;
97 std::unique_ptr< PrivateData > m_data;
98};
99
100#endif
Base class of all controls.
Definition QskControl.h:23
virtual void changeEvent(QEvent *)
Definition QskItem.cpp:859