QFontDialog(3qt)
π QFontDialog β the glow-up your fonts deserve π
okay bestie, so this is QFontDialog from the Qt 3 docs (manual page name qfontdialog.3qt, if you're keeping receipts). It's the dialog widget you pop open when you want someone to pick a font. Gorgeous. Iconic. Let's get into it.
β¨ NAME β¨
QFontDialog β the dialog widget for selecting a font π
πΈ SYNOPSIS πΈ
#include <qfontdialog.h>
It inherits QDialog. So it's a QDialog at heart, just with a whole font-picker personality.
β Static Public Members β
QFont getFont ( bool * ok, const QFont & initial, QWidget *
parent = 0, const char * name = 0 )
QFont getFont ( bool * ok, QWidget * parent = 0, const char * name = 0 )
Two of them. Overload besties. π
π¦ DESCRIPTION π¦
The QFontDialog class provides a dialog widget for selecting a font. That's the whole vibe. β¨
The usual way to use this class is to call one of the static convenience functions, e.g. getFont(). Literally the easiest path, no cap.
Examples:
bool ok;
QFont font = QFontDialog::getFont(
&ok, QFont( "Helvetica [Cronyx]", 10 ), this );
if ( ok ) {
// font is set to the font the user selected
} else {
// the user canceled the dialog; font is set to the initial
// value, in this case Helvetica [Cronyx], 10
}
The dialog can also be used to set a widget's font directly:
myWidget.setFont( QFontDialog::getFont( 0, myWidget.font() ) );
If the user clicks OK the font they chose will be used for myWidget, and if they click Cancel the original font is used. The way that it justβ¦ handles the whole thing for you. Obsessed. π«Ά
See also QFont, QFontInfo, QFontMetrics, and Dialog Classes.
[Image Omitted] β yeah bestie, there was a picture here and it did not survive the trip. π
π MEMBER FUNCTION DOCUMENTATION π
π QFont QFontDialog::getFont ( bool * ok, const QFont & initial, QWidget * parent = 0, const char * name = 0 ) [static]
Executes a modal font dialog and returns a font.
If the user clicks OK, the selected font is returned. If the user clicks Cancel, the initial font is returned. Simple as that, fr fr.
The dialog is called name, with the parent parent. initial is the initially selected font. If the ok parameter is not-null, *ok is set to TRUE if the user clicked OK, and set to FALSE if the user clicked Cancel.
This static function is less flexible than the full QFontDialog object, but is convenient and easy to use. Tradeoff queen. π
Examples:
bool ok;
QFont font = QFontDialog::getFont( &ok, QFont( "Times", 12 ), this );
if ( ok ) {
// font is set to the font the user selected
} else {
// the user canceled the dialog; font is set to the initial
// value, in this case Times, 12.
}
The dialog can also be used to set a widget's font directly:
myWidget.setFont( QFontDialog::getFont( 0, myWidget.font() ) );
In this example, if the user clicks OK the font they chose will be used, and if they click Cancel the original font is used. β¨
Examples:
(yes bestie, the original literally just says "Examples:" and then stops. nothing after it. we love a cliffhanger π)
π QFont QFontDialog::getFont ( bool * ok, QWidget * parent = 0, const char * name = 0 ) [static]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Same energy, different signature. π
Executes a modal font dialog and returns a font.
If the user clicks OK, the selected font is returned. If the user clicks Cancel, the Qt default font is returned. (yes, different from the other one β that's not a typo, that's just how it is π)
The dialog is called name, with parent parent. If the ok parameter is not-null, *ok is set to TRUE if the user clicked OK, and FALSE if the user clicked Cancel.
This static function is less functional than the full QFontDialog object, but is convenient and easy to use.
Example:
bool ok;
QFont font = QFontDialog::getFont( &ok, this );
if ( ok ) {
// font is set to the font the user selected
} else {
// the user canceled the dialog; font is set to the default
// application font, QApplication::font()
}
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
βοΈ AUTHOR βοΈ
Generated automatically from the source code. (no human author to credit, the machine did it π)
π BUGS π
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. π«Ά (genuinely though β good bug reports are the moment, bestie)
The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.
If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qfontdialog.3qt) and the Qt version (3.3.8). Include the receipts, bestie. π
aww okay that's the whole page!! π this one came from Trolltech AS, dated 2 February 2007, Qt version 3.3.8 β so like, a vintage icon, honestly. take care of her. mwah πβ¨
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms