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 QQUICKLABSPLATFORMCOLORDIALOG_P_H
5#define QQUICKLABSPLATFORMCOLORDIALOG_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 "qquicklabsplatformdialog_p.h"
19#include <QtGui/qcolor.h>
20#include <QtQml/qqml.h>
21
22#if QT_DEPRECATED_SINCE(6, 9)
23
24QT_BEGIN_NAMESPACE
25
26class QQuickLabsPlatformColorDialog : public QQuickLabsPlatformDialog
27{
28 Q_OBJECT
29 QML_NAMED_ELEMENT(ColorDialog)
30 QML_EXTENDED_NAMESPACE(QColorDialogOptions)
31 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
32 Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged FINAL)
33 Q_PROPERTY(QColorDialogOptions::ColorDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL)
34
35public:
36 explicit QQuickLabsPlatformColorDialog(QObject *parent = nullptr);
37
38 QColor color() const;
39 void setColor(const QColor &color);
40
41 QColor currentColor() const;
42 void setCurrentColor(const QColor &color);
43
44 QColorDialogOptions::ColorDialogOptions options() const;
45 void setOptions(QColorDialogOptions::ColorDialogOptions options);
46
47Q_SIGNALS:
48 void colorChanged();
49 void currentColorChanged();
50 void optionsChanged();
51
52protected:
53 bool useNativeDialog() const override;
54 void onCreate(QPlatformDialogHelper *dialog) override;
55 void onShow(QPlatformDialogHelper *dialog) override;
56 void accept() override;
57
58private:
59 QColor m_color;
60 QColor m_currentColor; // TODO: QColorDialogOptions::initialColor
61 QSharedPointer<QColorDialogOptions> m_options;
62};
63
64QT_END_NAMESPACE
65
66#endif // QT_DEPRECATED_SINCE(6, 9)
67
68#endif // QQUICKLABSPLATFORMCOLORDIALOG_P_H
69

source code of qtdeclarative/src/labs/platform/qquicklabsplatformcolordialog_p.h