Qt 6.x
The Qt SDK
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
63{
64}
65
79{
80 return selectedFont();
81}
82
84{
86}
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
156{
157 setOptions({});
158}
159
161{
164}
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:20
\inmodule QtCore
Definition qobject.h:90
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
Definition qobject.cpp:2823
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()
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent