|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QDialog
com.trolltech.qt.gui.QFontDialog
public class QFontDialog
The QFontDialog class provides a dialog widget for selecting a font. A font dialog is created through one of the static getFont()
functions.
Examples:
QFont font; QFontDialog.Result fontResult = QFontDialog.getFont(new QFont("Helvetica [Cronyx]", 10), this); if (fontResult.ok) { // the user clicked OK and font is set to the font the user selected font = fontResult.font; } else { // the user canceled the dialog; font is set to the initial // value, in this case Helvetica [Cronyx], 10 }The dialog can also be used to set a widget's font directly:
myWidget.setFont(QFontDialog.getFont(myWidget.font()).font);If the user clicks OK the font they chose will be used for myWidget, and if they click Cancel the original font is used.
QFont
, QFontInfo
, QFontMetrics
, QColorDialog
, QFileDialog
, QPrintDialog
, and Standard Dialogs Example.
Nested Class Summary | |
---|---|
static class |
QFontDialog.FontDialogOption
This enum specifies various options that affect the look and feel of a font dialog. |
static class |
QFontDialog.FontDialogOptions
|
static class |
QFontDialog.Result
|
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QDialog |
---|
QDialog.DialogCode |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary | |
---|---|
QSignalEmitter.Signal1 |
currentFontChanged
This signal takes 1 generic argument(s). |
QSignalEmitter.Signal1 |
fontSelected
This signal takes 1 generic argument(s). |
Fields inherited from class com.trolltech.qt.gui.QDialog |
---|
accepted, finished, rejected |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QFontDialog()
Constructs a standard font dialog. |
|
QFontDialog(QFont initial)
Constructs a standard font dialog with the given parent and specified initial color. |
|
QFontDialog(QFont initial,
QWidget parent)
Constructs a standard font dialog with the given parent and specified initial color. |
|
QFontDialog(QWidget parent)
Constructs a standard font dialog. |
Method Summary | |
---|---|
QFont |
currentFont()
|
static QFontDialog.Result |
getFont()
This is an overloaded method provided for convenience. |
static QFontDialog.Result |
getFont(QFont initial)
This is an overloaded method provided for convenience. |
static QFontDialog.Result |
getFont(QFont initial,
QWidget parent)
This is an overloaded method provided for convenience. |
static QFontDialog.Result |
getFont(QFont initial,
QWidget parent,
java.lang.String caption)
Executes a modal font dialog and returns a font. |
static QFontDialog.Result |
getFont(QFont initial,
QWidget parent,
java.lang.String title,
QFontDialog.FontDialogOptions options)
This is an overloaded method provided for convenience. |
static QFontDialog.Result |
getFont(QWidget parent)
This is an overloaded method provided for convenience. |
QFontDialog.FontDialogOptions |
options()
This property holds the various options that affect the look and feel of the dialog. |
QFont |
selectedFont()
Returns the font that the user selected by clicking the OK or equivalent button. |
void |
setCurrentFont(QFont font)
|
void |
setOption(QFontDialog.FontDialogOption option)
Sets the given option to be enabled if on is true; otherwise, clears the given option. |
void |
setOption(QFontDialog.FontDialogOption option,
boolean on)
Sets the given option to be enabled if on is true; otherwise, clears the given option. |
void |
setOptions(QFontDialog.FontDialogOption[] options)
This is an overloaded method provided for convenience. |
void |
setOptions(QFontDialog.FontDialogOptions options)
This property holds the various options that affect the look and feel of the dialog. |
boolean |
testOption(QFontDialog.FontDialogOption option)
Returns true if the given option is enabled; otherwise, returns false. |
Methods inherited from class com.trolltech.qt.gui.QDialog |
---|
accept, done, exec, isSizeGripEnabled, open, reject, result, setModal, setResult, setSizeGripEnabled |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Field Detail |
---|
public final QSignalEmitter.Signal1 currentFontChanged
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QFont(named: font)>:
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.
currentFont
, fontSelected()
, and selectedFont()
.
public final QSignalEmitter.Signal1 fontSelected
This signal takes 1 generic argument(s). We list their type and the name they go by in the description of this signal. <com.trolltech.qt.gui.QFont(named: font)>:
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.
selectedFont()
, currentFontChanged()
, and currentFont
.
Constructor Detail |
---|
public QFontDialog()
Use setCurrentFont()
to set the initial font attributes.
The parent parameter is passed to the QDialog
constructor.
getFont()
.
public QFontDialog(QWidget parent)
Use setCurrentFont()
to set the initial font attributes.
The parent parameter is passed to the QDialog
constructor.
getFont()
.
public QFontDialog(QFont initial)
public QFontDialog(QFont initial, QWidget parent)
Method Detail |
---|
public final QFont currentFont()
public final QFontDialog.FontDialogOptions options()
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).
setOption()
, and testOption()
.
public final QFont selectedFont()
Note: This font is not always the same as the font held by the currentFont
property since the user can choose different fonts before finally selecting the one to use.
public final void setCurrentFont(QFont font)
public final void setOption(QFontDialog.FontDialogOption option)
options
, and testOption()
.
public final void setOption(QFontDialog.FontDialogOption option, boolean on)
options
, and testOption()
.
public final void setOptions(QFontDialog.FontDialogOption[] options)
public final void setOptions(QFontDialog.FontDialogOptions options)
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).
setOption()
, and testOption()
.
public final boolean testOption(QFontDialog.FontDialogOption option)
options
, and setOption()
.
public static QFontDialog.Result getFont(QFont initial, QWidget parent, java.lang.String title, QFontDialog.FontDialogOptions options)
public static QFontDialog.Result getFont(QFont initial, QWidget parent, java.lang.String caption)
If the user clicks OK, the selected font is returned. If the user clicks Cancel, the initial font is returned.
The dialog is constructed with the given parent. caption is shown as the window title of the dialog and initial is the initially selected font.
This static function is less flexible than the full QFontDialog object, but is convenient and easy to use.
public static QFontDialog.Result getFont(QWidget parent)
public static QFontDialog.Result getFont()
public static QFontDialog.Result getFont(QFont initial, QWidget parent)
public static QFontDialog.Result getFont(QFont initial)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |