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#include "qwidgetplatformfontdialog_p.h"
5#include "qwidgetplatformdialog_p.h"
6
7#include <QtWidgets/qfontdialog.h>
8
9QT_BEGIN_NAMESPACE
10
11QWidgetPlatformFontDialog::QWidgetPlatformFontDialog(QObject *parent)
12 : m_dialog(new QFontDialog)
13{
14 setParent(parent);
15
16 connect(sender: m_dialog.data(), signal: &QFontDialog::accepted, context: this, slot: &QPlatformDialogHelper::accept);
17 connect(sender: m_dialog.data(), signal: &QFontDialog::rejected, context: this, slot: &QPlatformDialogHelper::reject);
18 connect(sender: m_dialog.data(), signal: &QFontDialog::currentFontChanged, context: this, slot: &QPlatformFontDialogHelper::currentFontChanged);
19}
20
21QWidgetPlatformFontDialog::~QWidgetPlatformFontDialog()
22{
23}
24
25QFont QWidgetPlatformFontDialog::currentFont() const
26{
27 return m_dialog->currentFont();
28}
29
30void QWidgetPlatformFontDialog::setCurrentFont(const QFont &font)
31{
32 m_dialog->setCurrentFont(font);
33}
34
35void QWidgetPlatformFontDialog::exec()
36{
37 m_dialog->exec();
38}
39
40bool QWidgetPlatformFontDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
41{
42 QSharedPointer<QFontDialogOptions> options = QPlatformFontDialogHelper::options();
43 m_dialog->setWindowTitle(options->windowTitle());
44 m_dialog->setOptions(static_cast<QFontDialog::FontDialogOptions>(int(options->options())) | QFontDialog::DontUseNativeDialog);
45
46 return QWidgetPlatformDialog::show(dialog: m_dialog.data(), flags, modality, parent);
47}
48
49void QWidgetPlatformFontDialog::hide()
50{
51 m_dialog->hide();
52}
53
54QT_END_NAMESPACE
55
56#include "moc_qwidgetplatformfontdialog_p.cpp"
57

source code of qtdeclarative/src/labs/platform/widgets/qwidgetplatformfontdialog.cpp