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 QQUICKLABSPLATFORMFONTDIALOG_P_H
5#define QQUICKLABSPLATFORMFONTDIALOG_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/qfont.h>
20#include <QtQml/qqml.h>
21
22#if QT_DEPRECATED_SINCE(6, 9)
23
24QT_BEGIN_NAMESPACE
25
26class QQuickLabsPlatformFontDialog : public QQuickLabsPlatformDialog
27{
28 Q_OBJECT
29 QML_NAMED_ELEMENT(FontDialog)
30 QML_EXTENDED_NAMESPACE(QFontDialogOptions)
31 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
32 Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged FINAL)
33 Q_PROPERTY(QFontDialogOptions::FontDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL)
34
35public:
36 explicit QQuickLabsPlatformFontDialog(QObject *parent = nullptr);
37
38 QFont font() const;
39 void setFont(const QFont &font);
40
41 QFont currentFont() const;
42 void setCurrentFont(const QFont &font);
43
44 QFontDialogOptions::FontDialogOptions options() const;
45 void setOptions(QFontDialogOptions::FontDialogOptions options);
46
47Q_SIGNALS:
48 void fontChanged();
49 void currentFontChanged();
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 QFont m_font;
60 QFont m_currentFont; // TODO: QFontDialogOptions::initialFont
61 QSharedPointer<QFontDialogOptions> m_options;
62};
63
64QT_END_NAMESPACE
65
66#endif // QT_DEPRECATED_SINCE(6, 9)
67
68#endif // QQUICKLABSPLATFORMFONTDIALOG_P_H
69

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