Home · Overviews · Examples 

QFontDialog Class Reference
[com.trolltech.qt.gui module]

The QFontDialog class provides a dialog widget for selecting a font. More...

Inherits QDialog.


Detailed Description

The QFontDialog class provides a dialog widget for selecting a font.

A font dialog is created through one of the static getFont() functions.

Examples:

    bool ok;
    QFont font = QFontDialog::getFont(
                    &ok, QFont("Helvetica [Cronyx]", 10), this);
    if (ok) {
        // the user clicked OK and 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.

A font dialog in the Plastique widget style.

See also QFont, QFontInfo, QFontMetrics, QColorDialog, QFileDialog, QPrintDialog, and Standard Dialogs Example.


Copyright © 2008 Trolltech Trademarks
Qt Jambi 4.3.5_01