KFontDialog Class Reference

`#include <kfontdialog.h>`

Inheritance diagram for KFontDialog:

## Signals

void | fontSelected (const QFont &font)
Signals inherited from KDialogBase
void | helpClicked ()
void | defaultClicked ()
void | user3Clicked ()
void | user2Clicked ()
void | user1Clicked ()
void | applyClicked ()
void | tryClicked ()
void | okClicked ()
void | yesClicked ()
void | noClicked ()
void | cancelClicked ()
void | closeClicked ()
void | apply ()
void | backgroundChanged ()
void | hidden ()
void | finished ()
void | aboutToShowDetails ()
void | aboutToShowPage (QWidget *page)
Signals inherited from KDialog
void | layoutHintChanged ()

## Public Member Functions

| KFontDialog (QWidget *parent=0L, const char *name=0, bool onlyFixed=false, bool modal=false, const QStringList &fontlist=QStringList(), bool makeFrame=true, bool diff=false, QButton::ToggleState *sizeIsRelativeState=0L)
void | setFont (const QFont &font, bool onlyFixed=false)
QFont | font () const
void | setSizeIsRelative (QButton::ToggleState relative)
QButton::ToggleState | sizeIsRelative () const
Public Member Functions inherited from KDialogBase
| KDialogBase (QWidget *parent=0, const char *name=0, bool modal=true, const QString &caption=QString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (int dialogFace, const QString &caption, int buttonMask, ButtonCode defaultButton, QWidget *parent=0, const char *name=0, bool modal=true, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (KDialogBase::DialogType dialogFace, WFlags f, QWidget *parent=0, const char *name=0, bool modal=true, const QString &caption=QString::null, int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok, bool separator=false, const KGuiItem &user1=KGuiItem(), const KGuiItem &user2=KGuiItem(), const KGuiItem &user3=KGuiItem())
| KDialogBase (const QString &caption, int buttonMask=Yes|No|Cancel, ButtonCode defaultButton=Yes, ButtonCode escapeButton=Cancel, QWidget *parent=0, const char *name=0, bool modal=true, bool separator=false, const KGuiItem &yes=KStdGuiItem::yes(), const KGuiItem &no=KStdGuiItem::no(), const KGuiItem &cancel=KStdGuiItem::cancel())
| ~KDialogBase ()
void | setButtonBoxOrientation (int orientation)
void | setEscapeButton (ButtonCode id)
virtual void | adjustSize ()
virtual QSize | sizeHint () const
virtual QSize | minimumSizeHint () const
QFrame * | plainPage ()
QFrame * | addPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QFrame * | addPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QVBox * | addVBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QVBox * | addVBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QHBox * | addHBoxPage (const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QHBox * | addHBoxPage (const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QGrid * | addGridPage (int n, Orientation dir, const QString &itemName, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
QGrid * | addGridPage (int n, Orientation dir, const QStringList &items, const QString &header=QString::null, const QPixmap &pixmap=QPixmap())
void | setFolderIcon (const QStringList &path, const QPixmap &pixmap)
QFrame * | makeMainWidget ()
QVBox * | makeVBoxMainWidget ()
QHBox * | makeHBoxMainWidget ()
QGrid * | makeGridMainWidget (int n, Orientation dir)
void | enableButtonSeparator (bool state)
void | showButton (ButtonCode id, bool state)
void | showButtonOK (bool state)
void | showButtonApply (bool state)
void | showButtonCancel (bool state)
bool | showPage (int index)
int | activePageIndex () const
int | pageIndex (QWidget *widget) const
void | setMainWidget (QWidget *widget)
QWidget * | mainWidget ()
void | disableResize ()
void | setInitialSize (const QSize &s, bool noResize=false)
void | incInitialSize (const QSize &s, bool noResize=false)
QSize | configDialogSize (const QString &groupName) const
QSize | configDialogSize (KConfig &config, const QString &groupName) const
void | saveDialogSize (const QString &groupName, bool global=false)
void | saveDialogSize (KConfig &config, const QString &groupName, bool global=false) const
void | setButtonOK (const KGuiItem &item=KStdGuiItem::ok())
void | setButtonOKText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonApply (const KGuiItem &item=KStdGuiItem::apply())
void | setButtonApplyText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonCancel (const KGuiItem &item=KStdGuiItem::cancel())
void | setButtonCancelText (const QString &text=QString::null, const QString &tooltip=QString::null, const QString &quickhelp=QString::null) KDE_DEPRECATED
void | setButtonText (ButtonCode id, const QString &text)
void | setButtonTip (ButtonCode id, const QString &text)
void | setButtonWhatsThis (ButtonCode id, const QString &text)
void | setButtonGuiItem (ButtonCode id, const KGuiItem &item)
void | setTreeListAutoResize (bool state)
void | setShowIconsInTreeList (bool state)
void | setRootIsDecorated (bool state)
void | unfoldTreeList (bool persist=false)
void | addWidgetBelowList (QWidget *widget)
void | addButtonBelowList (const QString &text, QObject *recv, const char *slot)
void | addButtonBelowList (const KGuiItem &guiitem, QObject *recv, const char *slot)
void | setIconListAllVisible (bool state)
void | showTile (bool state)
void | getBorderWidths (int &ulx, int &uly, int &lrx, int &lry) const KDE_DEPRECATED
QRect | getContentsRect () const KDE_DEPRECATED
QSize | calculateSize (int w, int h) const
QString | helpLinkText () const
QPushButton * | actionButton (ButtonCode id)
Public Member Functions inherited from KDialog
| KDialog (QWidget *parent=0, const char *name=0, bool modal=false, WFlags f=0)

## Static Public Member Functions

static int | getFont (QFont &theFont, bool onlyFixed=false, QWidget *parent=0L, bool makeFrame=true, QButton::ToggleState *sizeIsRelativeState=0L)
static int | getFontDiff (QFont &theFont, int &diffFlags, bool onlyFixed=false, QWidget *parent=0L, bool makeFrame=true, QButton::ToggleState *sizeIsRelativeState=0L)
static int | getFontAndText (QFont &theFont, QString &theString, bool onlyFixed=false, QWidget *parent=0L, bool makeFrame=true, QButton::ToggleState *sizeIsRelativeState=0L)
Static Public Member Functions inherited from KDialogBase
static bool | haveBackgroundTile ()
static const QPixmap * | backgroundTile ()
static const QPixmap * | getBackgroundTile () KDE_DEPRECATED
static void | setBackgroundTile (const QPixmap *pix)
Static Public Member Functions inherited from KDialog
static int | marginHint ()
static int | spacingHint ()
static void | resizeLayout (QWidget *widget, int margin, int spacing)
static void | resizeLayout (QLayoutItem *lay, int margin, int spacing)
static void | centerOnScreen (QWidget *widget, int screen=-1)
static bool | avoidArea (QWidget *widget, const QRect &area, int screen=-1)

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)
Protected Member Functions inherited from KDialogBase
virtual void | keyPressEvent (QKeyEvent *e)
virtual void | hideEvent (QHideEvent *)
virtual void | closeEvent (QCloseEvent *e)

## Protected Attributes

KFontChooser * | chooser

## Additional Inherited Members

Public Types inherited from KDialogBase
enum | ButtonCode { Help = 0x00000001, Default = 0x00000002, Ok = 0x00000004, Apply = 0x00000008, Try = 0x00000010, Cancel = 0x00000020, Close = 0x00000040, User1 = 0x00000080, User2 = 0x00000100, User3 = 0x00000200, No = 0x00000080, Yes = 0x00000100, Details = 0x00000400, Filler = 0x40000000, Stretch = 0x80000000, NoDefault }
enum | ActionButtonStyle { ActionStyle0 =0, ActionStyle1, ActionStyle2, ActionStyle3, ActionStyle4, ActionStyleMAX }
enum | DialogType { TreeList = KJanusWidget::TreeList, Tabbed = KJanusWidget::Tabbed, Plain = KJanusWidget::Plain, Swallow = KJanusWidget::Swallow, IconList = KJanusWidget::IconList }
Public Slots inherited from KDialogBase
void | enableButton (ButtonCode id, bool state)
void | enableButtonOK (bool state)
void | enableButtonApply (bool state)
void | enableButtonCancel (bool state)
void | enableLinkedHelp (bool state)
void | delayedDestruct ()
void | setHelpLinkText (const QString &text)
void | setHelp (const QString &anchor, const QString &appname=QString::null)
void | helpClickedSlot (const QString &)
void | setDetails (bool showDetails)
void | setDetailsWidget (QWidget *detailsWidget)
void | updateBackground ()
void | cancel ()
Public Slots inherited from KDialog
virtual void | polish ()
virtual void | setCaption (const QString &caption)
virtual void | setPlainCaption (const QString &caption)
Protected Slots inherited from KDialogBase
virtual void | slotHelp ()
virtual void | slotDefault ()
virtual void | slotDetails ()
virtual void | slotUser3 ()
virtual void | slotUser2 ()
virtual void | slotUser1 ()
virtual void | slotOk ()
virtual void | slotApply ()
virtual void | slotTry ()
virtual void | slotYes ()
virtual void | slotNo ()
virtual void | slotCancel ()
virtual void | slotClose ()
virtual void | applyPressed ()
void | updateGeometry ()
void | slotDelayedDestruct ()

## Detailed Description

A font selection dialog.

The KFontDialog provides a dialog for interactive font selection. It is basically a thin wrapper around the KFontChooser widget, which can also be used standalone. In most cases, the simplest use of this class is the static method KFontDialog::getFont(), which pops up the dialog, allows the user to select a font, and returns when the dialog is closed.

Example:

QFont myFont;
int result = KFontDialog::getFont( myFont );
if ( result == KFontDialog::Accepted )
...
KDE Font Dialog

Author
  Preston Brown pbrow.nosp@m.n@kd.nosp@m.e.org, Bernd Wuebben wuebb.nosp@m.en@k.nosp@m.de.or.nosp@m.g

Version

Id
  kfontdialog.h 465272 2005-09-29 09:47:40Z mueller

Definition at line 339 of file kfontdialog.h.

## Constructor & Destructor Documentation

KFontDialog::KFontDialog | ( | QWidget * | parent = `0L`,
|  | const char * | name = `0`,
|  | bool | onlyFixed = `false`,
|  | bool | modal = `false`,
|  | const QStringList & | fontlist = `QStringList()`,
|  | bool | makeFrame = `true`,
|  | bool | diff = `false`,
|  | QButton::ToggleState * | sizeIsRelativeState = `0L`
| ) |  |

Constructs a font selection dialog.

Parameters

  parent | The parent widget of the dialog, if any.
  name | The name of the dialog.
  modal | Specifies whether the dialog is modal or not.
  onlyFixed | only display fonts which have fixed-width character sizes.
  fontlist | a list of fonts to display, in XLFD format. If no list is formatted, the internal KDE font list is used. If that has not been created, X is queried, and all fonts available on the system are displayed.
  makeFrame | Draws a frame with titles around the contents.
  diff | Display the difference version dialog. See getFontDiff().
  sizeIsRelativeState | If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState, user choice may be retrieved by calling sizeIsRelative().

Definition at line 724 of file kfontdialog.cpp.

## Member Function Documentation

QFont KFontDialog::font | ( |  | ) | const

inline

Returns
  The currently selected font in the dialog.

Definition at line 384 of file kfontdialog.h.

void KFontDialog::fontSelected | ( | const QFont & | font | ) |

signal

Emitted whenever the currently selected font changes.

Connect to this to monitor the font as it is selected if you are not running modal.

int KFontDialog::getFont | ( | QFont & | theFont,
|  | bool | onlyFixed = `false`,
|  | QWidget * | parent = `0L`,
|  | bool | makeFrame = `true`,
|  | QButton::ToggleState * | sizeIsRelativeState = `0L`
| ) |  |

static

Creates a modal font dialog, lets the user choose a font, and returns when the dialog is closed.

Parameters

  theFont | a reference to the font to write the chosen font into.
  onlyFixed | if true, only select from fixed-width fonts.
  parent | Parent widget of the dialog. Specifying a widget different from 0 (Null) improves centering (looks better).
  makeFrame | Draws a frame with titles around the contents.
  sizeIsRelativeState | If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState and user choice will be returned therein.

Returns
  QDialog::result().

Definition at line 756 of file kfontdialog.cpp.

int KFontDialog::getFontAndText | ( | QFont & | theFont,
|  | QString & | theString,
|  | bool | onlyFixed = `false`,
|  | QWidget * | parent = `0L`,
|  | bool | makeFrame = `true`,
|  | QButton::ToggleState * | sizeIsRelativeState = `0L`
| ) |  |

static

When you are not only interested in the font selected, but also in the example string typed in, you can call this method.

Parameters

  theFont | a reference to the font to write the chosen font into.
  theString | a reference to the example text that was typed.
  onlyFixed | if true, only select from fixed-width fonts.
  parent | Parent widget of the dialog. Specifying a widget different from 0 (Null) improves centering (looks better).
  makeFrame | Draws a frame with titles around the contents.
  sizeIsRelativeState | If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState and user choice will be returned therein.

Returns
  The result of the dialog.

Definition at line 775 of file kfontdialog.cpp.

int KFontDialog::getFontDiff | ( | QFont & | theFont,
|  | int & | diffFlags,
|  | bool | onlyFixed = `false`,
|  | QWidget * | parent = `0L`,
|  | bool | makeFrame = `true`,
|  | QButton::ToggleState * | sizeIsRelativeState = `0L`
| ) |  |

static

Creates a modal font difference dialog, lets the user choose a selection of changes that should be made to a set of fonts, and returns when the dialog is closed.

Useful for choosing slight adjustments to the font set when the user would otherwise have to manually edit a number of fonts.

Parameters

  theFont | a reference to the font to write the chosen font into.
  diffFlags | a reference to the int into which the chosen difference selection bitmask should be written. Check the returned bitmask like: if ( diffFlags & KFontChooser::FontDiffFamily ) [...] if ( diffFlags & KFontChooser::FontDiffStyle ) [...] if ( diffFlags & KFontChooser::FontDiffSize ) [...]
  onlyFixed | if true, only select from fixed-width fonts.
  parent | Parent widget of the dialog. Specifying a widget different from 0 (Null) improves centering (looks better).
  makeFrame | Draws a frame with titles around the contents.
  sizeIsRelativeState | If not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState and user choice will be returned therein.

Returns
  QDialog::result().

Definition at line 737 of file kfontdialog.cpp.

void KFontDialog::setFont | ( | const QFont & | font,
|  | bool | onlyFixed = `false`
| ) |  |

inline

Sets the currently selected font in the dialog.

Parameters

  font | The font to select.
  onlyFixed | readjust the font list to display only fixed width fonts if true, or vice-versa

Definition at line 378 of file kfontdialog.h.

void KFontDialog::setSizeIsRelative | ( | QButton::ToggleState | relative | ) |

inline

Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size.

NOTE: If parameter sizeIsRelative was not set in the constructor of the dialog this setting will be ignored.

Definition at line 392 of file kfontdialog.h.

QButton::ToggleState KFontDialog::sizeIsRelative | ( |  | ) | const

inline

Returns
  Whether the font size is to be interpreted as relative size (default: false)

Definition at line 399 of file kfontdialog.h.

The documentation for this class was generated from the following files:

- kfontdialog.h
- kfontdialog.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys