- class QFontComboBox¶
The
QFontComboBox
widget is a combobox that lets the user select a font family. More…Synopsis¶
Properties¶
currentFontᅟ
- The currently selected fontfontFiltersᅟ
- The filter for the comboboxwritingSystemᅟ
- The writing system that serves as a filter for the combobox
Methods¶
def
__init__()
def
currentFont()
def
fontFilters()
def
setDisplayFont()
def
setFontFilters()
def
writingSystem()
Slots¶
def
setCurrentFont()
Signals¶
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
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 aQComboBox
for controlling the font size and twoQToolButton
s for bold and italic.When the user selects a new font, the
currentFontChanged()
signal is emitted in addition tocurrentIndexChanged()
.Call
setWritingSystem()
to tellQFontComboBox
to show only fonts that support a given writing system, andsetFontFilters()
to filter out certain types of fonts as e.g. non scalable fonts or monospaced fonts.See also
QComboBox
QFontQFontInfoQFontMetricsQFontDatabase
- class FontFilter¶
(inherits
enum.Flag
) This enum can be used to only show certain types of fonts in the font combo box.Constant
Description
QFontComboBox.AllFonts
Show all fonts
QFontComboBox.ScalableFonts
Show scalable fonts
QFontComboBox.NonScalableFonts
Show non scalable fonts
QFontComboBox.MonospacedFonts
Show monospaced fonts
QFontComboBox.ProportionalFonts
Show proportional fonts
Note
Properties can be used directly when
from __feature__ import true_property
is used or via accessor functions otherwise.This property holds the currently selected font.
See also
- Access functions:
- property fontFiltersᅟ: Combination of QFontComboBox.FontFilter¶
This property holds the filter for the combobox.
By default, all fonts are listed.
See also
- Access functions:
- property 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.See also
- Access functions:
Constructs a font combobox with the given
parent
.- currentFont()¶
- Return type:
See also
Getter of property
currentFontᅟ
.This signal is emitted whenever the current font changes, with the new
font
.See also
Notification signal of property
currentFontᅟ
.- fontFilters()¶
- Return type:
Combination of
FontFilter
See also
Getter of property
fontFiltersᅟ
.- sampleTextForFont(fontFamily)¶
- Parameters:
fontFamily – str
- Return type:
str
Returns the sample text to show after the font name (when the combo is open) for a given
fontFamily
.See also
- sampleTextForSystem(writingSystem)¶
- Parameters:
writingSystem –
WritingSystem
- Return type:
str
Returns the sample text to show after the font name (when the combo is open) for a given
writingSystem
.See also
Setter of property
currentFontᅟ
.Sets the
font
to be used to display a givenfontFamily
(when the combo is open).See also
displayFont()
- setFontFilters(filters)¶
- Parameters:
filters – Combination of
FontFilter
See also
Setter of property
fontFiltersᅟ
.- setSampleTextForFont(fontFamily, sampleText)¶
- Parameters:
fontFamily – str
sampleText – str
Sets the
sampleText
to show after the font name (when the combo is open) for a givenfontFamily
.The sample text given with this function has priority over the one set with
setSampleTextForSystem()
.See also
- setSampleTextForSystem(writingSystem, sampleText)¶
- Parameters:
writingSystem –
WritingSystem
sampleText – str
Sets the
sampleText
to show after the font name (when the combo is open) for a givenwritingSystem
.The sample text given with
setSampleTextForFont()
has priority.See also
- setWritingSystem(arg__1)¶
- Parameters:
arg__1 –
WritingSystem
See also
Setter of property
writingSystemᅟ
.- writingSystem()¶
- Return type:
See also
Getter of property
writingSystemᅟ
.