DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dquickdciiconimage_p.h
1// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DQUICKDCIICONIMAGE_P_H
6#define DQUICKDCIICONIMAGE_P_H
7
8#include "dquickiconimage_p.h"
9#include "dqmlglobalobject_p.h"
10
11#include <dtkdeclarative_global.h>
12#include <DObject>
13#include <DDciIcon>
14#include <DDciIconPalette>
15
16DQUICK_BEGIN_NAMESPACE
17DGUI_USE_NAMESPACE
18
19class DQuickDciIconImageItem;
20class DQuickIconAttached;
21class DQuickDciIconImagePrivate;
22class DQuickDciIconImage : public QQuickItem, DCORE_NAMESPACE::DObject
23{
24 Q_OBJECT
25 D_DECLARE_PRIVATE(DQuickDciIconImage)
26 Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged FINAL)
27 Q_PROPERTY(DTK_QUICK_NAMESPACE::DQMLGlobalObject::ControlState mode READ mode WRITE setMode NOTIFY modeChanged FINAL)
28 Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType theme READ theme WRITE setTheme NOTIFY themeChanged FINAL)
29 Q_PROPERTY(DTK_GUI_NAMESPACE::DDciIconPalette palette READ palette WRITE setPalette NOTIFY paletteChanged)
30 Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
31 Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged)
32 Q_PROPERTY(bool fallbackToQIcon READ fallbackToQIcon WRITE setFallbackToQIcon NOTIFY fallbackToQIconChanged)
33#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
34 QML_NAMED_ELEMENT(DciIcon)
35 QML_ATTACHED(DQuickIconAttached)
36#endif
37
38public:
39 explicit DQuickDciIconImage(QQuickItem *parent = nullptr);
40 ~DQuickDciIconImage() override;
41
42 QString name() const;
43 void setName(const QString &name);
44
45 DQMLGlobalObject::ControlState mode() const;
46 void setMode(DQMLGlobalObject::ControlState mode);
47
48 DGuiApplicationHelper::ColorType theme() const;
49 void setTheme(DGuiApplicationHelper::ColorType theme);
50
51 DDciIconPalette palette() const;
52 void setPalette(const DDciIconPalette &palette);
53
54 QSize sourceSize() const;
55 void setSourceSize(const QSize &size);
56
57 void setMirror(bool mirror);
58 bool mirror() const;
59
60 bool fallbackToQIcon() const;
61 void setFallbackToQIcon(bool newFallbackToQIcon);
62
63 DQuickIconImage *imageItem() const;
64
65 static bool isNull(const QString &iconName);
66 static DQuickIconAttached *qmlAttachedProperties(QObject *object);
67
68Q_SIGNALS:
69 void nameChanged();
70 void modeChanged();
71 void themeChanged();
72 void paletteChanged();
73 void sourceSizeChanged();
74 void mirrorChanged();
75 void fallbackToQIconChanged();
76
77protected:
78 void classBegin() override;
79 void componentComplete() override;
80};
81
83class DQuickIconAttached : public QObject, DCORE_NAMESPACE::DObject
84{
85 Q_OBJECT
86 D_DECLARE_PRIVATE(DQuickIconAttached)
87 Q_PROPERTY(DTK_QUICK_NAMESPACE::DQMLGlobalObject::ControlState mode READ mode WRITE setMode NOTIFY modeChanged)
88 Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType theme READ theme WRITE setTheme NOTIFY themeChanged)
89 Q_PROPERTY(DTK_GUI_NAMESPACE::DDciIconPalette palette READ palette WRITE setPalette NOTIFY paletteChanged)
90 Q_PROPERTY(bool fallbackToQIcon READ fallbackToQIcon WRITE setFallbackToQIcon NOTIFY fallbackToQIconChanged)
91
92public:
93 explicit DQuickIconAttached(QQuickItem *parent);
95
96 DQMLGlobalObject::ControlState mode() const;
97 void setMode(DQMLGlobalObject::ControlState mode);
98
99 DGuiApplicationHelper::ColorType theme() const;
100 void setTheme(DGuiApplicationHelper::ColorType theme);
101
102 DDciIconPalette palette() const;
103 void setPalette(const DDciIconPalette &palette);
104
105 bool fallbackToQIcon() const;
106 void setFallbackToQIcon(bool newFallbackToQIcon);
107
108Q_SIGNALS:
109 void modeChanged();
110 void themeChanged();
111 void paletteChanged();
112 void fallbackToQIconChanged();
113};
114
115DQUICK_END_NAMESPACE
116QML_DECLARE_TYPEINFO(DTK_QUICK_NAMESPACE::DQuickDciIconImage, QML_HAS_ATTACHED_PROPERTIES)
117#endif // DQUICKDCIICONIMAGE_P_H
Definition dquickdciiconimage_p.h:23
Definition dquickdciiconimage.cpp:240
Definition dquickdciiconimage_p.h:84
Definition dquickiconimage_p.h:23