Classes - Annotated - Tree - Functions - Home - Structure

QFontDialog Class Reference

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

#include <qfontdialog.h>

Inherits QDialog.

List of all member functions.

Signals

Static Public Members

Protected Members

Protected Slots


Detailed Description

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

This dialog can be used to let the user choose a font with attributes, etc. Normally you may use the static convenience function getFont().


Member Function Documentation

bool QFontDialog::eventFilter ( QObject * o, QEvent * e ) [virtual protected]

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.

Reimplemented from QDialog.

QListBox * QFontDialog::familyListBox () const [protected]

Returns a pointer to the "font family" list box. This is usable mainly 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 was 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]

Opens a modal font dialog and returns the font selected by the user.

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 FALSE if the user clicked Cancel.

If the user clicks Cancel, the initial font is returned.

This static function is less capable than the full QFontDialog object, but is convenient and easy to use.

Example:

    // start at the current working directory and with *.cpp as filter
    bool ok;
    QFont f = QFontDialog::getFont( &ok, QFont( "Times", 12 ), this );
    if ( ok ) {
        // the user selected a valid font
    } else {
        // the user cancelled the dialog
    }
  

Another example:

    mywidget.setFont( QFontDialog::getFont( 0, mywidget.font() ) );
  

Examples: qfd/fontdisplayer.cpp and xform/xform.cpp.

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.

Opens a modal font dialog and returns the font selected by the user.

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.

If the user clicks Cancel, the Qt default font is returned.

This static function is less capable than the full QFontDialog object, but is convenient and easy to use.

Example:

    // start at the current working directory and with *.cpp as filter
    bool ok;
    QFont f = QFontDialog::getFont( &ok, this );
    if ( ok ) {
        // the user selected a valid font
    } else {
        // the user cancelled the dialog
    }
  

QComboBox * QFontDialog::scriptCombo () const [protected]

Returns a pointer to the "font style" list box. This is usable mainly 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 usable mainly if you reimplement updateFontSizes();

QListBox * QFontDialog::styleListBox () const [protected]

Returns a pointer to the "font style" list box. This is usable mainly 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.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):


This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.


Copyright © 2001 TrolltechTrademarks
Qt version 3.0.0-beta1-beta1