QtBase
v6.3.1
|
The QFontDialog class provides a dialog widget for selecting a font. More...
#include <qfontdialog.h>
Public Types | |
enum | FontDialogOption { NoButtons = 0x00000001 , DontUseNativeDialog = 0x00000002 , ScalableFonts = 0x00000004 , NonScalableFonts = 0x00000008 , MonospacedFonts = 0x00000010 , ProportionalFonts = 0x00000020 } |
Public Types inherited from QDialog | |
enum | DialogCode { Rejected , Accepted } |
Public Types inherited from QWidget | |
enum | RenderFlag { DrawWindowBackground = 0x1 , DrawChildren = 0x2 , IgnoreMask = 0x4 } |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1 , PdmHeight , PdmWidthMM , PdmHeightMM , PdmNumColors , PdmDepth , PdmDpiX , PdmDpiY , PdmPhysicalDpiX , PdmPhysicalDpiY , PdmDevicePixelRatio , PdmDevicePixelRatioScaled } |
Public Slots | |
virtual void | open () |
Public Slots inherited from QDialog | |
virtual void | open () |
virtual int | exec () |
virtual void | accept () |
virtual void | reject () |
Public Slots inherited from QWidget | |
void | setEnabled (bool) |
void | setDisabled (bool) |
void | setWindowModified (bool) |
void | setWindowTitle (const QString &) |
void | setStyleSheet (const QString &styleSheet) |
void | setFocus () |
void | update () |
void | repaint () |
void | setHidden (bool hidden) |
void | show () |
void | hide () |
void | showMinimized () |
void | showMaximized () |
void | showFullScreen () |
void | showNormal () |
bool | close () |
void | raise () |
void | lower () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals | |
void | currentFontChanged (const QFont &font) |
void | fontSelected (const QFont &font) |
Signals inherited from QDialog | |
void | finished (int result) |
void | accepted () |
void | rejected () |
Signals inherited from QWidget | |
void | windowTitleChanged (const QString &title) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | customContextMenuRequested (const QPoint &pos) |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Properties | |
QFont | currentFont |
the current font of the dialog. More... | |
FontDialogOptions | options |
the various options that affect the look and feel of the dialog More... | |
Properties inherited from QDialog | |
bool | sizeGripEnabled |
whether the size grip is enabled More... | |
bool | modal |
whether show() should pop up the dialog as modal or modeless More... | |
Properties inherited from QWidget | |
bool | modal |
whether the widget is a modal widget More... | |
Qt::WindowModality | windowModality |
which windows are blocked by the modal widget More... | |
bool | enabled |
whether the widget is enabled More... | |
QRect | geometry |
the geometry of the widget relative to its parent and excluding the window frame More... | |
QRect | frameGeometry |
geometry of the widget relative to its parent including any window frame More... | |
QRect | normalGeometry |
the geometry of the widget as it will appear when shown as a normal (not maximized or full screen) top-level widget More... | |
int | x |
the x coordinate of the widget relative to its parent including any window frame More... | |
int | y |
the y coordinate of the widget relative to its parent and including any window frame More... | |
QPoint | pos |
the position of the widget within its parent widget More... | |
QSize | frameSize |
the size of the widget including any window frame More... | |
QSize | size |
the size of the widget excluding any window frame More... | |
int | width |
the width of the widget excluding any window frame More... | |
int | height |
the height of the widget excluding any window frame More... | |
QRect | rect |
the internal geometry of the widget excluding any window frame More... | |
QRect | childrenRect |
the bounding rectangle of the widget's children More... | |
QRegion | childrenRegion |
the combined region occupied by the widget's children More... | |
QSizePolicy | sizePolicy |
the default layout behavior of the widget More... | |
QSize | minimumSize |
the widget's minimum size More... | |
QSize | maximumSize |
the widget's maximum size in pixels More... | |
int | minimumWidth |
the widget's minimum width in pixels More... | |
int | minimumHeight |
the widget's minimum height in pixels More... | |
int | maximumWidth |
the widget's maximum width in pixels More... | |
int | maximumHeight |
the widget's maximum height in pixels More... | |
QSize | sizeIncrement |
the size increment of the widget More... | |
QSize | baseSize |
the base size of the widget More... | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the font currently set for the widget More... | |
QCursor | cursor |
the cursor shape for this widget More... | |
bool | mouseTracking |
whether mouse tracking is enabled for the widget More... | |
bool | tabletTracking |
whether tablet tracking is enabled for the widget More... | |
bool | isActiveWindow |
whether this widget's window is the active window More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
bool | focus |
whether this widget (or its focus proxy) has the keyboard input focus More... | |
Qt::ContextMenuPolicy | contextMenuPolicy |
how the widget shows a context menu More... | |
bool | updatesEnabled |
whether updates are enabled More... | |
bool | visible |
whether the widget is visible More... | |
bool | minimized |
whether this widget is minimized (iconified) More... | |
bool | maximized |
whether this widget is maximized More... | |
bool | fullScreen |
whether the widget is shown in full screen mode More... | |
QSize | sizeHint |
the recommended size for the widget More... | |
QSize | minimumSizeHint |
the recommended minimum size for the widget More... | |
bool | acceptDrops |
whether drop events are enabled for this widget More... | |
QString | windowTitle |
the window title (caption) More... | |
QIcon | windowIcon |
the widget's icon More... | |
QString | windowIconText |
the text to be displayed on the icon of a minimized window More... | |
double | windowOpacity |
The level of opacity for the window. More... | |
bool | windowModified |
whether the document shown in the window has unsaved changes More... | |
QString | accessibleName |
the widget's name as seen by assistive technologies More... | |
QString | accessibleDescription |
the widget's description as seen by assistive technologies More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QString | styleSheet |
the widget's style sheet More... | |
QLocale | locale |
the widget's locale More... | |
QString | windowFilePath |
the file path associated with a widget More... | |
Qt::InputMethodHints | inputMethodHints |
What input method specific hints the widget has. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Additional Inherited Members | |
Protected Slots inherited from QWidget | |
void | updateMicroFocus (Qt::InputMethodQuery query=Qt::ImQueryAll) |
Protected Attributes inherited from QObject | |
QScopedPointer< QObjectData > | d_ptr |
Protected Attributes inherited from QPaintDevice | |
ushort | painters |
Related Functions inherited from QWidget | |
setupUi (QWidget *widget) | |
Related Functions inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
The QFontDialog class provides a dialog widget for selecting a font.
\inmodule QtWidgets
A font dialog is created through one of the static getFont() functions.
Examples:
The dialog can also be used to set a widget's font directly:
If the user clicks OK the font they chose will be used for myWidget, and if they click Cancel the original font is used.
A font dialog in the Fusion widget style.
Definition at line 55 of file qfontdialog.h.
This enum specifies various options that affect the look and feel of a font dialog.
For instance, it allows to specify which type of font should be displayed. If none are specified all fonts available will be listed.
Note that the font filtering options might not be supported on some platforms (e.g. Mac). They are always supported by the non native dialog (used on Windows or Linux).
\value NoButtons Don't display \uicontrol{OK} and \uicontrol{Cancel} buttons. (Useful for "live dialogs".) \value DontUseNativeDialog Use Qt's standard font dialog on the Mac instead of Apple's native font panel. \value ScalableFonts Show scalable fonts \value NonScalableFonts Show non scalable fonts \value MonospacedFonts Show monospaced fonts \value ProportionalFonts Show proportional fonts
Enumerator | |
---|---|
NoButtons | |
DontUseNativeDialog | |
ScalableFonts | |
NonScalableFonts | |
MonospacedFonts | |
ProportionalFonts |
Definition at line 63 of file qfontdialog.h.
Constructs a standard font dialog.
Use setCurrentFont() to set the initial font attributes.
The parent parameter is passed to the QDialog constructor.
Definition at line 155 of file qfontdialog.cpp.
Constructs a standard font dialog with the given parent and specified initial font.
Definition at line 168 of file qfontdialog.cpp.
QFontDialog::~QFontDialog | ( | ) |
Definition at line 337 of file qfontdialog.cpp.
\reimp
Reimplemented from QWidget.
Definition at line 789 of file qfontdialog.cpp.
QFont QFontDialog::currentFont | ( | ) | const |
Returns the current font.
Definition at line 836 of file qfontdialog.cpp.
This signal is emitted when the current font is changed. The new font is specified in font.
The signal is emitted while a user is selecting a font. Ultimately, the chosen font may differ from the font currently selected.
|
overrideprotectedvirtual |
Closes the dialog and sets its result code to result. If this dialog is shown with exec(), done() causes the local event loop to finish, and exec() to return result.
Reimplemented from QDialog.
Definition at line 1012 of file qfontdialog.cpp.
\reimp
Reimplemented from QDialog.
Definition at line 423 of file qfontdialog.cpp.
This signal is emitted when a font has been selected. The selected font is specified in font.
The signal is only emitted when a user has chosen the final font to be used. It is not emitted while the user is changing the current font in the font dialog.
|
static |
Executes a modal font dialog and returns a font.
If the user clicks \uicontrol OK, the selected font is returned. If the user clicks \uicontrol Cancel, the initial font is returned.
The dialog is constructed with the given parent and the options specified in options. title is shown as the window title of the dialog and initial is the initially selected font. If the ok parameter is not-null, the value it refers to is set to true if the user clicks \uicontrol OK, and set to false if the user clicks \uicontrol Cancel.
Examples:
The dialog can also be used to set a widget's font directly:
In this example, if the user clicks OK the font they chose will be used, and if they click Cancel the original font is used.
Definition at line 365 of file qfontdialog.cpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Executes a modal font dialog and returns a font.
If the user clicks \uicontrol OK, the selected font is returned. If the user clicks \uicontrol Cancel, the Qt default font is returned.
The dialog is constructed with the given parent. If the ok parameter is not-null, the value it refers to is set to true if the user clicks \uicontrol OK, and false if the user clicks \uicontrol Cancel.
Example:
Definition at line 391 of file qfontdialog.cpp.
|
slot |
Shows the dialog as a \l{QDialog::Modal Dialogs}{window modal dialog}, returning immediately.
Definition at line 87 of file qdialog.cpp.
Opens the dialog and connects its fontSelected() signal to the slot specified by receiver and member.
The signal will be disconnected from the slot when the dialog is closed.
Definition at line 946 of file qfontdialog.cpp.
QFontDialog::FontDialogOptions QFontDialog::options | ( | ) | const |
QFont QFontDialog::selectedFont | ( | ) | const |
Returns the font that the user selected by clicking the \uicontrol{OK} or equivalent button.
Definition at line 852 of file qfontdialog.cpp.
Sets the font highlighted in the QFontDialog to the given font.
Definition at line 812 of file qfontdialog.cpp.
void QFontDialog::setOption | ( | FontDialogOption | option, |
bool | on = true |
||
) |
Sets the given option to be enabled if on is true; otherwise, clears the given option.
Definition at line 889 of file qfontdialog.cpp.
void QFontDialog::setOptions | ( | FontDialogOptions | options | ) |
|
overridevirtual |
\reimp
Reimplemented from QDialog.
Definition at line 987 of file qfontdialog.cpp.
bool QFontDialog::testOption | ( | FontDialogOption | option | ) | const |
Returns true
if the given option is enabled; otherwise, returns false.
Definition at line 902 of file qfontdialog.cpp.
|
readwrite |
|
readwrite |
the various options that affect the look and feel of the dialog
By default, all options are disabled.
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).
Definition at line 120 of file qfontdialog.h.