3#include <QtQuick/private/qquicktext_p.h>
4#include "qml_material/util/text_control_background.hpp"
5#include "qml_material/util/control_environment.hpp"
11class QML_MATERIAL_API Label :
public QQuickText,
public ControlEnvironment {
13 QML_NAMED_ELEMENT(LabelBase)
14 Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
16 QQuickItem* background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
17 Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY
18 implicitBackgroundWidthChanged FINAL)
19 Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY
20 implicitBackgroundHeightChanged FINAL)
21 Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY
22 topInsetChanged FINAL)
23 Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY
24 leftInsetChanged FINAL)
25 Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY
26 rightInsetChanged FINAL)
27 Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY
28 bottomInsetChanged FINAL)
31 explicit Label(QQuickItem* parent =
nullptr);
34 void setFont(
const QFont&);
36 QFont effectiveFont()
const override {
return m_effective_font; }
37 void inheritFont(
const QFont&)
override;
38 QQuickItem* background()
const {
return m_background.item(); }
39 void setBackground(QQuickItem*);
40 qreal implicitBackgroundWidth()
const;
41 qreal implicitBackgroundHeight()
const;
42 qreal topInset()
const {
return m_background.inset(Qt::TopEdge); }
43 void setTopInset(qreal);
45 Q_SIGNAL
void topInsetChanged();
46 qreal leftInset()
const {
return m_background.inset(Qt::LeftEdge); }
47 void setLeftInset(qreal);
48 void resetLeftInset();
49 Q_SIGNAL
void leftInsetChanged();
50 qreal rightInset()
const {
return m_background.inset(Qt::RightEdge); }
51 void setRightInset(qreal);
52 void resetRightInset();
53 Q_SIGNAL
void rightInsetChanged();
54 qreal bottomInset()
const {
return m_background.inset(Qt::BottomEdge); }
55 void setBottomInset(qreal);
56 void resetBottomInset();
57 Q_SIGNAL
void bottomInsetChanged();
59 Q_SIGNAL
void fontChanged();
60 Q_SIGNAL
void backgroundChanged();
61 Q_SIGNAL
void implicitBackgroundWidthChanged();
62 Q_SIGNAL
void implicitBackgroundHeightChanged();
65 void componentComplete()
override;
66 void itemChange(ItemChange,
const ItemChangeData&)
override;
67 void geometryChange(
const QRectF&,
const QRectF&)
override;
71 QFont m_requested_font;
72 QFont m_effective_font;
73 TextControlBackground m_background;