QFontComboBox Class Reference

[ QtGui module]

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

继承 QComboBox .

类型

方法

Qt Signals


详细描述

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 QToolButton s for bold and italic.

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

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

Screenshot of QFontComboBox on Windows XP


类型文档编制

QFontComboBox.FontFilter

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

常量 描述
QFontComboBox.AllFonts 0 Show all fonts
QFontComboBox.ScalableFonts 0x1 Show scalable fonts
QFontComboBox.NonScalableFonts 0x2 Show non scalable fonts
QFontComboBox.MonospacedFonts 0x4 Show monospaced fonts
QFontComboBox.ProportionalFonts 0x8 Show proportional fonts

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


方法文档编制

QFontComboBox.__init__ ( self , QWidget   parent  = None)

parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a font combobox with the given parent .

QFont QFontComboBox.currentFont ( self )

bool QFontComboBox.event ( self , QEvent   e )

重实现自 QObject.event ().

FontFilters QFontComboBox.fontFilters ( self )

QFontComboBox.setCurrentFont ( self , QFont   f )

This method is also a Qt slot with the C++ signature void setCurrentFont(const QFont&) .

QFontComboBox.setFontFilters ( self , FontFilters   filters )

QFontComboBox.setWritingSystem ( self , QFontDatabase.WritingSystem )

QSize QFontComboBox.sizeHint ( self )

重实现自 QWidget.sizeHint ().

QFontDatabase.WritingSystem QFontComboBox.writingSystem ( self )


Qt Signal Documentation

void currentFontChanged (const QFont&)

This is the default overload of this signal.

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

另请参阅 currentFont .