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 isSoftwareRender READ isSoftwareRender FINAL CONSTANT)
124 Q_PROPERTY(DTK_GUI_NAMESPACE::DWindowManagerHelper::WMName windowManagerName READ windowManagerName CONSTANT)
125 Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType READ themeType NOTIFY themeTypeChanged)
126 Q_PROPERTY(QString windowManagerNameString READ windowManagerNameString CONSTANT)
128 Q_PROPERTY(DTK_GUI_NAMESPACE::DFontManager *fontManager READ fontManager FINAL CONSTANT)
129#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
130 Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged)
131 Q_PROPERTY(QPalette inactivePalette READ inactivePalette NOTIFY inactivePaletteChanged)
133 Q_PROPERTY(QQuickPalette* palette READ quickPalette NOTIFY paletteChanged)
134 Q_PROPERTY(QQuickPalette* inactivePalette READ inactiveQuickPalette NOTIFY inactivePaletteChanged)
136 Q_PROPERTY(QString deepinDistributionOrgLogo READ deepinDistributionOrgLogo CONSTANT)
137 Q_PROPERTY(QString deepinWebsiteName READ deepinWebsiteName CONSTANT)
138 Q_PROPERTY(QString deepinWebsiteLink READ deepinWebsiteLink CONSTANT)
139#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
140 QML_NAMED_ELEMENT(
DTK)
180#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
181 enum class CompositionMode {
182 Source = QPainter::CompositionMode_Source,
183 SourceOver = QPainter::CompositionMode_SourceOver,
184 Destination = QPainter::CompositionMode_Destination,
185 DestinationOver = QPainter::CompositionMode_DestinationOver,
186 Clear = QPainter::CompositionMode_Clear,
188 Q_ENUM(CompositionMode)
191 bool hasBlurWindow()
const;
192 bool hasComposite()
const;
193 bool hasNoTitlebar()
const;
194 static bool hasAnimation();
195 static bool isSoftwareRender();
197 DWindowManagerHelper::WMName windowManagerName()
const;
198 QString windowManagerNameString()
const;
200 DGuiApplicationHelper::ColorType themeType()
const;
203 DFontManager *fontManager()
const;
205 QPalette palette()
const;
206 QPalette inactivePalette()
const;
207#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
208 QQuickPalette *quickPalette()
const;
209 QQuickPalette *inactiveQuickPalette()
const;
212 Q_INVOKABLE QColor blendColor(
const QColor &substrate,
const QColor &superstratum);
213 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(DTK_QUICK_NAMESPACE::DColor::Type type);
214 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(
const QColor &color);
215 Q_INVOKABLE QUrl makeShadowImageUrl(qreal boxSize, qreal cornerRadius, qreal shadowBlur,
216 QColor color, qreal xOffset, qreal yOffset, qreal spread,
217 bool hollow,
bool inner);
218 Q_INVOKABLE QUrl makeShadowImageUrl(qreal boxSize, qreal topLeftRadius, qreal topRightRadius, qreal bottomLeftRadius, qreal bottomRightRadius,
219 qreal shadowBlur, QColor color, qreal xOffset, qreal yOffset, qreal spread,
220 bool hollow,
bool inner);
222 Q_INVOKABLE DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType toColorType(
const QColor &color);
223 Q_INVOKABLE QColor selectColor(
const QColor &windowColor,
const QColor &light,
const QColor &dark);
225 QString deepinWebsiteName()
const;
226 QString deepinWebsiteLink()
const;
227 QString deepinDistributionOrgLogo()
const;
229 Q_INVOKABLE QPoint cursorPosition()
const;
231 Q_INVOKABLE DTK_QUICK_NAMESPACE::DQuickDciIcon makeIcon(
const QJSValue &qicon,
const QJSValue &iconExtra);
232#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
233 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QPalette &palette);
235 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QQuickPalette *palette);
238 Q_INVOKABLE
bool sendMessage(QObject *target,
const QString &content,
const QString &iconName = QString(),
int duration = 4000,
const QString &msgId = QString());
239 Q_INVOKABLE
bool sendMessage(QObject *target, QQmlComponent *delegate,
const QVariant &message,
int duration = 4000,
const QString &msgId = QString());
240 Q_INVOKABLE
void closeMessage(DTK_QUICK_NAMESPACE::FloatingMessageContainer *message);
241 Q_INVOKABLE
void closeMessage(QObject *target,
const QString &msgId);
242 Q_INVOKABLE
void sendSystemMessage(
const QString &summary,
const QString &body = QString(),
243 const QString &appIcon = QString(),
const QStringList &actions = QStringList(),
244 const QVariantMap hints = QVariantMap(),
const int timeout = 3000,
const uint replaceId = 0);
246 static void setPopupMode(
const PopupMode mode);
247 static bool loadTranslator();
249#if QT_VERSION_MAJOR > 5
250 static QSGRootNode *getRootNode(QQuickItem *item);
251 static int &QSGNode_subtreeRenderableCount(QSGNode *node);
252 static QSGNode* &QSGNode_firstChild(QSGNode *node);
253 static QSGNode* &QSGNode_lastChild(QSGNode *node);
254 static QSGNode* &QSGNode_parent(QSGNode *node);
259 void hasBlurWindowChanged();
260 void hasCompositeChanged();
261 void hasNoTitlebarChanged();
262 void hasAnimationChanged();
263 void paletteChanged();
264 void inactivePaletteChanged();
265 void themeTypeChanged(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType);
270 D_PRIVATE_SLOT(
void _q_onPaletteChanged())