A font dialog. 更多...
导入语句: | import QtQuick.Dialogs |
Since: | Qt 6.2 |
继承: | Dialog |
The FontDialog type provides a QML API for font dialogs.
To show a font dialog, construct an instance of FontDialog, set the desired properties, and call open() 。 currentFont property can be used to determine the currently selected font in the dialog. The selectedFont property is updated only after the final selection has been made by accepting the dialog.
MenuItem { text: "Font" onTriggered: fontDialog.open() } FontDialog { id: fontDialog currentFont.family: document.font } MyDocument { id: document font: fontDialog.selectedFont }
A native platform font dialog is currently available on the following platforms:
Qt Quick Dialogs uses a Qt Quick implementation as a fallback on platforms that do not have a native implementation available.
currentFont : font |
This property holds the currently selected font in the dialog.
不像
selectedFont
property, the
currentFont
property is updated while the user is selecting fonts in the dialog, even before the final selection has been made.
另请参阅 selectedFont .
options : flags |
This property holds the various options that affect the look and feel of the dialog.
默认情况下,所有选项是被禁用的。
Options should be set before showing the dialog. Setting them while the dialog is visible is not guaranteed to have an immediate effect on the dialog (depending on the option and on the platform).
Available options:
常量 | 描述 |
---|---|
FontDialog.ScalableFonts
|
Show scalable fonts. |
FontDialog.NonScalableFonts
|
Show non-scalable fonts. |
FontDialog.MonospacedFonts
|
Show monospaced fonts. |
FontDialog.ProportionalFonts
|
Show proportional fonts. |
FontDialog.NoButtons
|
不显示 打开 and Cancel buttons (useful for "live dialogs"). |
selectedFont : font |
This property holds the final accepted font.
不像
currentFont
property, the
selectedFont
property is not updated while the user is selecting fonts in the dialog, but only after the final selection has been made. That is, when the user has clicked
打开
to accept a font. Alternatively, the
accepted()
signal can be handled to get the final selection.
另请参阅 currentFont and accepted() .