39#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
40 QML_VALUE_TYPE(dcolor)
51 inline DColor(
const QColor &color) {
52 data.color.value = color;
54#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
55 DColor(
const QJSValue ¶ms) :
DColor(QColor(params.toString())) { }
59 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(Data));
65 [[nodiscard]]
bool isValid()
const noexcept;
66 [[nodiscard]]
bool isTypedColor()
const noexcept;
67 [[nodiscard]] quint8 type()
const noexcept;
69 bool operator==(
const DColor &c)
const noexcept;
70 bool operator!=(
const DColor &c)
const noexcept;
71 inline DColor &operator=(
const QColor &color) {
72 data.color.value = color;
76 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(Data));
80 data.hue = std::move(other.data.hue);
81 data.saturation = std::move(other.data.saturation);
82 data.lightness = std::move(other.data.lightness);
83 data.opacity = std::move(other.data.opacity);
84 data.color.value = std::move(other.data.color.value);
88 Q_INVOKABLE QColor toColor(
const QPalette &palette)
const;
89 Q_INVOKABLE QColor color()
const;
90 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor hue(qint8 floatValue)
const;
91 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor saturation(qint8 floatValue)
const;
92 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor lightness(qint8 floatValue)
const;
93 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor opacity(qint8 floatValue)
const;
103 #ifdef Q_COMPILER_UNIFORM_INIT
107 QColor value = QColor();
119 Q_PROPERTY(
bool hasBlurWindow READ hasBlurWindow NOTIFY hasBlurWindowChanged)
120 Q_PROPERTY(
bool hasComposite READ hasComposite NOTIFY hasCompositeChanged)
121 Q_PROPERTY(
bool hasNoTitlebar READ hasNoTitlebar NOTIFY hasNoTitlebarChanged)
122 Q_PROPERTY(
bool hasAnimation READ hasAnimation NOTIFY hasAnimationChanged)
123 Q_PROPERTY(
bool hasInWindowBlur READ hasInWindowBlur NOTIFY hasInWindowBlurChanged)
124 Q_PROPERTY(
bool isSoftwareRender READ isSoftwareRender FINAL CONSTANT)
125 Q_PROPERTY(DTK_GUI_NAMESPACE::DWindowManagerHelper::WMName windowManagerName READ windowManagerName CONSTANT)
126 Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType READ themeType NOTIFY themeTypeChanged)
127 Q_PROPERTY(QString windowManagerNameString READ windowManagerNameString CONSTANT)
129 Q_PROPERTY(DTK_GUI_NAMESPACE::DFontManager *fontManager READ fontManager FINAL CONSTANT)
130#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
131 Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged)
132 Q_PROPERTY(QPalette inactivePalette READ inactivePalette NOTIFY inactivePaletteChanged)
134 Q_PROPERTY(QQuickPalette* palette READ quickPalette NOTIFY paletteChanged)
135 Q_PROPERTY(QQuickPalette* inactivePalette READ inactiveQuickPalette NOTIFY inactivePaletteChanged)
137 Q_PROPERTY(QString deepinDistributionOrgLogo READ deepinDistributionOrgLogo CONSTANT)
138 Q_PROPERTY(QString deepinWebsiteName READ deepinWebsiteName CONSTANT)
139 Q_PROPERTY(QString deepinWebsiteLink READ deepinWebsiteLink CONSTANT)
140#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
141 QML_NAMED_ELEMENT(
DTK)
174#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
175 enum class CompositionMode {
176 Source = QPainter::CompositionMode_Source,
177 SourceOver = QPainter::CompositionMode_SourceOver,
178 Destination = QPainter::CompositionMode_Destination,
179 DestinationOver = QPainter::CompositionMode_DestinationOver,
180 Clear = QPainter::CompositionMode_Clear,
182 Q_ENUM(CompositionMode)
185 bool hasBlurWindow()
const;
186 bool hasComposite()
const;
187 bool hasNoTitlebar()
const;
188 static bool hasAnimation();
189 static bool hasInWindowBlur();
190 static bool isSoftwareRender();
192 DWindowManagerHelper::WMName windowManagerName()
const;
193 QString windowManagerNameString()
const;
195 DGuiApplicationHelper::ColorType themeType()
const;
198 DFontManager *fontManager()
const;
200 QPalette palette()
const;
201 QPalette inactivePalette()
const;
202#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
203 QQuickPalette *quickPalette()
const;
204 QQuickPalette *inactiveQuickPalette()
const;
207 Q_INVOKABLE QColor blendColor(
const QColor &substrate,
const QColor &superstratum);
208 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(DTK_QUICK_NAMESPACE::DColor::Type type);
209 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(
const QColor &color);
210 Q_INVOKABLE QUrl makeShadowImageUrl(qreal boxSize, qreal cornerRadius, qreal shadowBlur,
211 QColor color, qreal xOffset, qreal yOffset, qreal spread,
212 bool hollow,
bool inner);
213 Q_INVOKABLE QUrl makeShadowImageUrl(qreal boxSize, qreal topLeftRadius, qreal topRightRadius, qreal bottomLeftRadius, qreal bottomRightRadius,
214 qreal shadowBlur, QColor color, qreal xOffset, qreal yOffset, qreal spread,
215 bool hollow,
bool inner);
217 Q_INVOKABLE DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType toColorType(
const QColor &color);
218 Q_INVOKABLE QColor selectColor(
const QColor &windowColor,
const QColor &light,
const QColor &dark);
220 QString deepinWebsiteName()
const;
221 QString deepinWebsiteLink()
const;
222 QString deepinDistributionOrgLogo()
const;
224 Q_INVOKABLE QPoint cursorPosition()
const;
226 Q_INVOKABLE DTK_QUICK_NAMESPACE::DQuickDciIcon makeIcon(
const QJSValue &qicon,
const QJSValue &iconExtra);
227#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
228 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QPalette &palette);
230 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QQuickPalette *palette);
233 Q_INVOKABLE
bool sendMessage(QObject *target,
const QString &content,
const QString &iconName = QString(),
int duration = 4000,
const QString &msgId = QString());
234 Q_INVOKABLE
bool sendMessage(QObject *target, QQmlComponent *delegate,
const QVariant &message,
int duration = 4000,
const QString &msgId = QString());
235 Q_INVOKABLE
void closeMessage(DTK_QUICK_NAMESPACE::FloatingMessageContainer *message);
236 Q_INVOKABLE
void closeMessage(QObject *target,
const QString &msgId);
237 Q_INVOKABLE
void sendSystemMessage(
const QString &summary,
const QString &body = QString(),
238 const QString &appIcon = QString(),
const QStringList &actions = QStringList(),
239 const QVariantMap hints = QVariantMap(),
const int timeout = 3000,
const uint replaceId = 0);
241 static bool loadTranslator();
243#if QT_VERSION_MAJOR > 5
244 static QSGRootNode *getRootNode(QQuickItem *item);
245 static int &QSGNode_subtreeRenderableCount(QSGNode *node);
246 static QSGNode* &QSGNode_firstChild(QSGNode *node);
247 static QSGNode* &QSGNode_lastChild(QSGNode *node);
248 static QSGNode* &QSGNode_parent(QSGNode *node);
253 void hasBlurWindowChanged();
254 void hasCompositeChanged();
255 void hasNoTitlebarChanged();
256 void hasAnimationChanged();
257 void hasInWindowBlurChanged();
258 void paletteChanged();
259 void inactivePaletteChanged();
260 void themeTypeChanged(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType);
265 D_PRIVATE_SLOT(
void _q_onPaletteChanged())