1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKICONLABEL_P_P_H
5#define QQUICKICONLABEL_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick/private/qquickitem_p.h>
19#include <QtQuickControls2Impl/private/qtquickcontrols2implglobal_p.h>
20#include <QtQuickControls2Impl/private/qquickiconlabel_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QQuickIconImage;
25class QQuickMnemonicLabel;
26
27class Q_AUTOTEST_EXPORT QQuickIconLabelPrivate : public QQuickItemPrivate,
28 public QSafeQuickItemChangeListener<QQuickIconLabelPrivate>
29{
30 Q_DECLARE_PUBLIC(QQuickIconLabel)
31
32public:
33 ~QQuickIconLabelPrivate() override;
34
35 bool hasIcon() const;
36 bool hasText() const;
37
38 bool createImage();
39 bool destroyImage();
40 bool updateImage();
41 void syncImage();
42 void updateOrSyncImage();
43
44 bool createLabel();
45 bool destroyLabel();
46 bool updateLabel();
47 void syncLabel();
48 void updateOrSyncLabel();
49
50 void updateImplicitSize();
51 void layout();
52
53 void watchChanges(QQuickItem *item);
54 void unwatchChanges(QQuickItem *item);
55 void setPositioningDirty();
56
57 bool isLeftToRight() const;
58
59 void itemImplicitWidthChanged(QQuickItem *) override;
60 void itemImplicitHeightChanged(QQuickItem *) override;
61 void itemDestroyed(QQuickItem *item) override;
62
63 bool mirrored = false;
64 QQuickIconLabel::Display display = QQuickIconLabel::TextBesideIcon;
65 Qt::Alignment alignment = Qt::AlignCenter;
66 qreal spacing = 0;
67 qreal topPadding = 0;
68 qreal leftPadding = 0;
69 qreal rightPadding = 0;
70 qreal bottomPadding = 0;
71 QFont font;
72 QColor color;
73 QString text;
74 QQuickIcon icon;
75 QQuickIconImage *image = nullptr;
76 QQuickMnemonicLabel *label = nullptr;
77};
78
79QT_END_NAMESPACE
80
81#endif // QQUICKICONLABEL_P_P_H
82

source code of qtdeclarative/src/quickcontrolsimpl/qquickiconlabel_p_p.h