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
22QT_BEGIN_NAMESPACE
23
24class QQuickLabsPlatformFontDialog : public QQuickLabsPlatformDialog
25{
26 Q_OBJECT
27 QML_NAMED_ELEMENT(FontDialog)
28 QML_EXTENDED_NAMESPACE(QFontDialogOptions)
29 Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
30 Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged FINAL)
31 Q_PROPERTY(QFontDialogOptions::FontDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL)
32
33public:
34 explicit QQuickLabsPlatformFontDialog(QObject *parent = nullptr);
35
36 QFont font() const;
37 void setFont(const QFont &font);
38
39 QFont currentFont() const;
40 void setCurrentFont(const QFont &font);
41
42 QFontDialogOptions::FontDialogOptions options() const;
43 void setOptions(QFontDialogOptions::FontDialogOptions options);
44
45Q_SIGNALS:
46 void fontChanged();
47 void currentFontChanged();
48 void optionsChanged();
49
50protected:
51 bool useNativeDialog() const override;
52 void onCreate(QPlatformDialogHelper *dialog) override;
53 void onShow(QPlatformDialogHelper *dialog) override;
54 void accept() override;
55
56private:
57 QFont m_font;
58 QFont m_currentFont; // TODO: QFontDialogOptions::initialFont
59 QSharedPointer<QFontDialogOptions> m_options;
60};
61
62QT_END_NAMESPACE
63
64QML_DECLARE_TYPE(QQuickLabsPlatformFontDialog)
65
66#endif // QQUICKLABSPLATFORMFONTDIALOG_P_H
67

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