Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:qgetfontdialog}

Name

qgetfontdialog — dialog for font selection

...

The font dialog is modal, meaning script execution is halted until the user closes the dialog.

Arguments

initialfont

A font object that determines the initial font displayed in the dialog. This typically contains the existing font for the widget in question, allowing the user to see what font is already in use.

parent

A parent widget. If this argument is provided, the font dialog will position itself on top of the parent widget.

Examples

Ex.1: Font dialog

...

No Format
bgColor#eeeeee
borderWidth1

# Set editor font
proc set_font {} {
	set f [qgetfontdialog]
	if { $f == "" } return

	qsetfont $::editor $f
	qsetfont $::button $f
}

# Toplevel window with editor
set w [qwidget]
qsetwindowtitle "Font"
qvboxlayout {
	set editor [qtextedit]
	set button [qpushbutton "Font" set_font]
}

qshow $w

...