QFontDialog(3qt)

NAME
QFontDialog - Dialog widget for selecting a font

SYNOPSIS
#include <qfontdialog.h>

Inherits QDialog.

  Signals

void fontSelected ( const QFont & font )

void fontHighlighted ( const QFont & font )

  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 )

  Protected Members

virtual bool eventFilter ( QObject * o, QEvent * e )

QListBox * familyListBox () const

virtual void updateFamilies ()

QListBox * styleListBox () const

virtual void updateStyles ()

QListBox * sizeListBox () const

virtual void updateSizes ()

QComboBox * scriptCombo () const

virtual void updateScripts ()

  Protected Slots

void sizeChanged ( const QString & s )

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

The usual way to use this class is to call one of the static convenience functions, getFont(), e.g.

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 cancelled 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:

    aWidget.setFont( QFontDialog::getFont( 0, aWidget.font() ) );
If the user clicks OK the font they chose will be used for aWidget, and if they click cancel the original font is kept.

See also QFont, QFontInfo, QFontMetrics and Dialog Classes.

[Image Omitted]

[Image Omitted]

MEMBER FUNCTION DOCUMENTATION

bool QFontDialog::eventFilter ( QObject * o, QEvent * e ) [virtual protected]
An event filter to make the Up, Down, PageUp and PageDown keys work correctly in the line edits. The source of the event is the object o and the event is e.

QListBox * QFontDialog::familyListBox () const [protected]
Returns a pointer to the "font family" list box. This is mainly useful if you reimplement updateFontFamilies();

void QFontDialog::fontHighlighted ( const QFont & font ) [signal]
This signal is emitted when the user changed a setting in the dialog. The font that is highlighted is passed in font.

void QFontDialog::fontSelected ( const QFont & font ) [signal]
This signal is emitted when the user has chosen a font and clicked OK. The font that was selected is passed in font.

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.

The dialog has parent parent and is called name. initial is the initial 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.

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 cancelled 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 kept.

Examples:

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.

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.

The dialog has parent parent and is called name. 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 cancelled the dialog; font is set to the default
        // application font, QApplication::font()
    }

QComboBox * QFontDialog::scriptCombo () const [protected]
Returns a pointer to the "font style" list box. This is mainly useful if you reimplement updateFontStyles();

void QFontDialog::sizeChanged ( const QString & s ) [protected slot]
This slot is called if the user changes the font size. The size is passed in the s argument as a string.

QListBox * QFontDialog::sizeListBox () const [protected]
Returns a pointer to the "font size" list box. This is mainly useful if you reimplement updateFontSizes();

QListBox * QFontDialog::styleListBox () const [protected]
Returns a pointer to the "font style" list box. This is mainly useful if you reimplement updateFontStyles();

void QFontDialog::updateFamilies () [virtual protected]
Updates the contents of the "font family" list box. This function can be reimplemented if you have special requirements.

void QFontDialog::updateScripts () [virtual protected]
Updates the contents of the "font script" combo box. This function can be reimplemented if you have special requirements.

void QFontDialog::updateSizes () [virtual protected]
Updates the contents of the "font size" list box. This function can be reimplemented if you have special requirements.

void QFontDialog::updateStyles () [virtual protected]
Updates the contents of the "font style" list box. This function can be reimplemented if you have special requirements.

SEE ALSO
http://doc.trolltech.com/qfontdialog.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2001 Trolltech AS, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

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.

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.0.3).