Qt
6.x
The Qt SDK
Loading...
Searching...
No Matches
src_gui_dialogs_qfontdialog.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5
bool
ok
;
6
QFont
font
=
QFontDialog::getFont
(
7
&
ok
,
QFont
(
"Helvetica [Cronyx]"
, 10),
this
);
8
if
(
ok
) {
9
// the user clicked OK and font is set to the font the user selected
10
}
else
{
11
// the user canceled the dialog; font is set to the initial
12
// value, in this case Helvetica [Cronyx], 10
13
}
15
16
18
myWidget.setFont(
QFontDialog::getFont
(0, myWidget.font()));
20
21
23
bool
ok
;
24
QFont
font
=
QFontDialog::getFont
(&
ok
,
QFont
(
"Times"
, 12),
this
);
25
if
(
ok
) {
26
// font is set to the font the user selected
27
}
else
{
28
// the user canceled the dialog; font is set to the initial
29
// value, in this case Times, 12.
30
}
32
33
35
myWidget.setFont(
QFontDialog::getFont
(0, myWidget.font()));
37
38
40
bool
ok
;
41
QFont
font
=
QFontDialog::getFont
(&
ok
,
this
);
42
if
(
ok
) {
43
// font is set to the font the user selected
44
}
else
{
45
// the user canceled the dialog; font is set to the default
46
// application font, QApplication::font()
47
}
QFontDialog::getFont
static QFont getFont(bool *ok, QWidget *parent=nullptr)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition
qfontdialog.cpp:357
QFont
\reentrant
Definition
qfont.h:20
ok
bool ok
[0]
Definition
src_gui_dialogs_qfontdialog.cpp:5
font
QFont font
Definition
src_gui_dialogs_qfontdialog.cpp:6
qtbase
src
widgets
doc
snippets
code
src_gui_dialogs_qfontdialog.cpp
Generated by
1.9.7