36#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
38 QML_NAMED_ELEMENT(
Color)
39 QML_UNCREATABLE(
"Color is only available as enums.")
50 inline DColor(
const QColor &color) {
51 data.color.value = color;
53#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
54 DColor(
const QJSValue ¶ms) :
DColor(QColor(params.toString())) { }
58 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(Data));
64 [[nodiscard]]
bool isValid()
const noexcept;
65 [[nodiscard]]
bool isTypedColor()
const noexcept;
67 bool operator==(
const DColor &c)
const noexcept;
68 bool operator!=(
const DColor &c)
const noexcept;
69 inline DColor &operator=(
const QColor &color) {
70 data.color.value = color;
74 memcpy(
static_cast<void*
>(&data),
static_cast<const void*
>(&other.data),
sizeof(Data));
78 data.hue = std::move(other.data.hue);
79 data.saturation = std::move(other.data.saturation);
80 data.lightness = std::move(other.data.lightness);
81 data.opacity = std::move(other.data.opacity);
82 data.color.value = std::move(other.data.color.value);
86 Q_INVOKABLE QColor toColor(
const QPalette &palette)
const;
87 Q_INVOKABLE QColor color()
const;
88 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor hue(qint8 floatValue)
const;
89 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor saturation(qint8 floatValue)
const;
90 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor lightness(qint8 floatValue)
const;
91 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor opacity(qint8 floatValue)
const;
101 #ifdef Q_COMPILER_UNIFORM_INIT
105 QColor value = QColor();
117 Q_PROPERTY(
bool hasBlurWindow READ hasBlurWindow NOTIFY hasBlurWindowChanged)
118 Q_PROPERTY(
bool hasComposite READ hasComposite NOTIFY hasCompositeChanged)
119 Q_PROPERTY(
bool hasNoTitlebar READ hasNoTitlebar NOTIFY hasNoTitlebarChanged)
120 Q_PROPERTY(
bool isSoftwareRender READ isSoftwareRender FINAL CONSTANT)
121 Q_PROPERTY(DTK_GUI_NAMESPACE::DWindowManagerHelper::WMName windowManagerName READ windowManagerName CONSTANT)
122 Q_PROPERTY(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType READ themeType NOTIFY themeTypeChanged)
123 Q_PROPERTY(QString windowManagerNameString READ windowManagerNameString CONSTANT)
125 Q_PROPERTY(DTK_GUI_NAMESPACE::DFontManager *fontManager READ fontManager FINAL CONSTANT)
126#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
127 Q_PROPERTY(QPalette palette READ palette NOTIFY paletteChanged)
128 Q_PROPERTY(QPalette inactivePalette READ inactivePalette NOTIFY inactivePaletteChanged)
130 Q_PROPERTY(QQuickPalette* palette READ quickPalette NOTIFY paletteChanged)
131 Q_PROPERTY(QQuickPalette* inactivePalette READ inactiveQuickPalette NOTIFY inactivePaletteChanged)
133 Q_PROPERTY(QString deepinDistributionOrgLogo READ deepinDistributionOrgLogo CONSTANT)
134 Q_PROPERTY(QString deepinWebsiteName READ deepinWebsiteName CONSTANT)
135 Q_PROPERTY(QString deepinWebsiteLink READ deepinWebsiteLink CONSTANT)
136#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
137 QML_NAMED_ELEMENT(
DTK)
177 bool hasBlurWindow()
const;
178 bool hasComposite()
const;
179 bool hasNoTitlebar()
const;
180 bool isSoftwareRender()
const;
182 DWindowManagerHelper::WMName windowManagerName()
const;
183 QString windowManagerNameString()
const;
185 DGuiApplicationHelper::ColorType themeType()
const;
188 DFontManager *fontManager()
const;
190 QPalette palette()
const;
191 QPalette inactivePalette()
const;
192#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
193 QQuickPalette *quickPalette()
const;
194 QQuickPalette *inactiveQuickPalette()
const;
197 Q_INVOKABLE QColor blendColor(
const QColor &substrate,
const QColor &superstratum);
198 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(DTK_QUICK_NAMESPACE::DColor::Type type);
199 Q_INVOKABLE DTK_QUICK_NAMESPACE::DColor makeColor(
const QColor &color);
200 Q_INVOKABLE QUrl makeShadowImageUrl(qreal boxSize, qreal cornerRadius, qreal shadowBlur,
201 QColor color, qreal xOffset, qreal yOffset, qreal spread,
202 bool hollow,
bool inner);
204 Q_INVOKABLE DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType toColorType(
const QColor &color);
205 Q_INVOKABLE QColor selectColor(
const QColor &windowColor,
const QColor &light,
const QColor &dark);
207 QString deepinWebsiteName()
const;
208 QString deepinWebsiteLink()
const;
209 QString deepinDistributionOrgLogo()
const;
211 Q_INVOKABLE QPoint cursorPosition()
const;
213 Q_INVOKABLE DTK_QUICK_NAMESPACE::DQuickDciIcon makeIcon(
const QJSValue &qicon,
const QJSValue &iconExtra);
214#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
215 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QPalette &palette);
217 Q_INVOKABLE DTK_GUI_NAMESPACE::DDciIconPalette makeIconPalette(
const QQuickPalette *palette);
220 Q_INVOKABLE
bool sendMessage(QObject *target,
const QString &content,
const QString &iconName = QString(),
int duration = 4000,
const QString &msgId = QString());
221 Q_INVOKABLE
bool sendMessage(QObject *target, QQmlComponent *delegate,
const QVariant &message,
int duration = 4000,
const QString &msgId = QString());
222 Q_INVOKABLE
void closeMessage(DTK_QUICK_NAMESPACE::FloatingMessageContainer *message);
223 Q_INVOKABLE
void closeMessage(QObject *target,
const QString &msgId);
224 Q_INVOKABLE
void sendSystemMessage(
const QString &summary,
const QString &body = QString(),
225 const QString &appIcon = QString(),
const QStringList &actions = QStringList(),
226 const QVariantMap hints = QVariantMap(),
const int timeout = 3000,
const uint replaceId = 0);
228 static void setPopupMode(
const PopupMode mode);
229 static bool loadTranslator();
232 void hasBlurWindowChanged();
233 void hasCompositeChanged();
234 void hasNoTitlebarChanged();
235 void paletteChanged();
236 void inactivePaletteChanged();
237 void themeTypeChanged(DTK_GUI_NAMESPACE::DGuiApplicationHelper::ColorType themeType);
241 D_PRIVATE_SLOT(
void _q_onPaletteChanged())