Home · All Namespaces · All Classes · Main Classes · Grouped Classes · Modules · Functions

QFontComboBox Class Reference
[QtGui module]

The QFontComboBox widget is a combobox that lets the user select a font family. More...

 #include <QFontComboBox>

Inherits QComboBox.

This class was introduced in Qt 4.2.

Public Types

Properties

Public Functions

Public Slots

Signals

Additional Inherited Members


Detailed Description

The QFontComboBox widget is a combobox that lets the user select a font family.

The combobox is populated with an alphabetized list of font family names, such as Arial, Helvetica, and Times New Roman. Family names are displayed using the actual font when possible. For fonts such as Symbol, where the name is not representable in the font itself, a sample of the font is displayed next to the family name.

QFontComboBox is often used in toolbars, in conjunction with a QComboBox for controlling the font size and two QToolButtons for bold and italic.

When the user selects a new font, the currentFontChanged() signal is emitted in addition to currentIndexChanged().

Call setWritingSystem() to tell QFontComboBox to show only fonts that support a given writing system, and setFontFilters() to filter out certain types of fonts as e.g. non scalable fonts or monospaced fonts.

Screenshot of QFontComboBox on Windows XP

See also QComboBox, QFont, QFontInfo, QFontMetrics, QFontDatabase, and Character Map Example.


Member Type Documentation

enum QFontComboBox::FontFilter
flags QFontComboBox::FontFilters

This enum can be used to only show certain types of fonts in the font combo box.

ConstantValueDescription
QFontComboBox::AllFonts0Show all fonts
QFontComboBox::ScalableFonts0x1Show scalable fonts
QFontComboBox::NonScalableFonts0x2Show non scalable fonts
QFontComboBox::MonospacedFonts0x4Show monospaced fonts
QFontComboBox::ProportionalFonts0x8Show proportional fonts

The FontFilters type is a typedef for QFlags<FontFilter>. It stores an OR combination of FontFilter values.


Property Documentation

currentFont : QFont

This property holds the currently selected font.

Access functions:

See also currentFontChanged(), currentIndex, and currentText.

fontFilters : FontFilters

This property holds the filter for the combobox.

By default, all fonts are listed.

Access functions:

See also writingSystem.

writingSystem : QFontDatabase::WritingSystem

This property holds the writing system that serves as a filter for the combobox.

If script is QFontDatabase::Any (the default), all fonts are listed.

Access functions:

See also fontFilters.


Member Function Documentation

QFontComboBox::QFontComboBox ( QWidget * parent = 0 )

Constructs a font combobox with the given parent.

QFontComboBox::~QFontComboBox ()

Destroys the combobox.

void QFontComboBox::currentFontChanged ( const QFont & font )   [signal]

This signal is emitted whenever the current font changes, with the new font.

See also currentFont.


Copyright © 2008 Nokia Trademarks
Qt 4.4.3