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, public QQuickItemChangeListener
28{
29 Q_DECLARE_PUBLIC(QQuickIconLabel)
30
31public:
32 ~QQuickIconLabelPrivate() override;
33
34 bool hasIcon() const;
35 bool hasText() const;
36
37 bool createImage();
38 bool destroyImage();
39 bool updateImage();
40 void syncImage();
41 void updateOrSyncImage();
42
43 bool createLabel();
44 bool destroyLabel();
45 bool updateLabel();
46 void syncLabel();
47 void updateOrSyncLabel();
48
49 void updateImplicitSize();
50 void layout();
51
52 void watchChanges(QQuickItem *item);
53 void unwatchChanges(QQuickItem *item);
54 void setPositioningDirty();
55
56 bool isLeftToRight() const;
57
58 void itemImplicitWidthChanged(QQuickItem *) override;
59 void itemImplicitHeightChanged(QQuickItem *) override;
60 void itemDestroyed(QQuickItem *item) override;
61
62 bool mirrored = false;
63 QQuickIconLabel::Display display = QQuickIconLabel::TextBesideIcon;
64 Qt::Alignment alignment = Qt::AlignCenter;
65 qreal spacing = 0;
66 qreal topPadding = 0;
67 qreal leftPadding = 0;
68 qreal rightPadding = 0;
69 qreal bottomPadding = 0;
70 QFont font;
71 QColor color;
72 QString text;
73 QQuickIcon icon;
74 QQuickIconImage *image = nullptr;
75 QQuickMnemonicLabel *label = nullptr;
76};
77
78QT_END_NAMESPACE
79
80#endif // QQUICKICONLABEL_P_P_H
81

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