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 QQUICKICON_P_H
5#define QQUICKICON_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 <QtCore/qurl.h>
19#include <QtCore/qstring.h>
20#include <QtCore/qobjectdefs.h>
21#include <QtCore/qshareddata.h>
22#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
23#include <QtGui/qcolor.h>
24#include <QtQml/qqml.h>
25
26QT_BEGIN_NAMESPACE
27
28class QQuickIconPrivate;
29
30class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickIcon
31{
32 Q_GADGET
33 Q_PROPERTY(QString name READ name WRITE setName RESET resetName FINAL)
34 Q_PROPERTY(QUrl source READ source WRITE setSource RESET resetSource FINAL)
35 Q_PROPERTY(int width READ width WRITE setWidth RESET resetWidth FINAL)
36 Q_PROPERTY(int height READ height WRITE setHeight RESET resetHeight FINAL)
37 Q_PROPERTY(QColor color READ color WRITE setColor RESET resetColor FINAL)
38 Q_PROPERTY(bool cache READ cache WRITE setCache RESET resetCache FINAL)
39 QML_ANONYMOUS
40 QML_ADDED_IN_VERSION(2, 3)
41
42public:
43 QQuickIcon();
44 QQuickIcon(const QQuickIcon &other);
45 ~QQuickIcon();
46
47 QQuickIcon& operator=(const QQuickIcon &other);
48 bool operator==(const QQuickIcon &other) const;
49 bool operator!=(const QQuickIcon &other) const;
50
51 bool isEmpty() const;
52
53 QString name() const;
54 void setName(const QString &name);
55 void resetName();
56
57 QUrl source() const;
58 void setSource(const QUrl &source);
59 void resetSource();
60 QUrl resolvedSource() const;
61 void ensureRelativeSourceResolved(const QObject *owner);
62
63 int width() const;
64 void setWidth(int width);
65 void resetWidth();
66
67 int height() const;
68 void setHeight(int height);
69 void resetHeight();
70
71 QColor color() const;
72 void setColor(const QColor &color);
73 void resetColor();
74
75 bool cache() const;
76 void setCache(bool cache);
77 void resetCache();
78
79 QQuickIcon resolve(const QQuickIcon &other) const;
80
81private:
82 QExplicitlySharedDataPointer<QQuickIconPrivate> d;
83};
84
85QT_END_NAMESPACE
86
87#endif // QQUICKICON_P_H
88

source code of qtdeclarative/src/quicktemplates/qquickicon_p.h