Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickfontdialog.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 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
5
6#include <QtCore/qloggingcategory.h>
7
9
14
58Q_LOGGING_CATEGORY(lcFontDialog, "qt.quick.dialogs.fontdialog")
59
65
82
87
105{
106 return m_selectedFont;
107}
108
110{
111 if (font == m_selectedFont)
112 return;
113
114 m_selectedFont = font;
115
118}
119
141QFontDialogOptions::FontDialogOptions QQuickFontDialog::options() const
142{
143 return m_options->options();
144}
145
146void QQuickFontDialog::setOptions(QFontDialogOptions::FontDialogOptions options)
147{
148 if (options == m_options->options())
149 return;
150
151 m_options->setOptions(options);
153}
154
159
165
167{
168 if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog)) {
170 [this, fontDialog]() { setSelectedFont(fontDialog->currentFont()); });
172 [this, fontDialog]() { fontDialog->setCurrentFont(m_selectedFont); });
173 fontDialog->setOptions(m_options);
174 }
175}
176
178{
179 m_options->setWindowTitle(title());
180 if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog)) {
181 fontDialog->setOptions(m_options); // setOptions only assigns a member and isn't virtual
182 fontDialog->setCurrentFont(m_selectedFont);
183 }
184
186}
187
189
190#include "moc_qquickfontdialog_p.cpp"
void setOptions(FontDialogOptions options)
void setWindowTitle(const QString &)
bool testOption(FontDialogOption option) const
FontDialogOptions options() const
\reentrant
Definition qfont.h:22
\inmodule QtCore
Definition qobject.h:103
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2960
The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
The QPlatformFontDialogHelper class allows for platform-specific customization of font dialogs.
void currentFontChanged(const QFont &font)
virtual bool useNativeDialog() const
virtual void onShow(QPlatformDialogHelper *dialog)
bool useNativeDialog() const override
void currentFontChanged()
QFontDialogOptions::FontDialogOptions options
void onShow(QPlatformDialogHelper *dialog) override
void setSelectedFont(const QFont &font)
void setCurrentFont(const QFont &font)
void setOptions(QFontDialogOptions::FontDialogOptions options)
void selectedFontChanged()
void onCreate(QPlatformDialogHelper *dialog) override
Combined button and popup list for selecting options.
SharedPointerFileDialogOptions m_options
#define Q_LOGGING_CATEGORY(name,...)
QQuickDialogType
#define emit
QFileDialog dialog(this)
[1]
view create()