class KFontChooser

A font selection widget. More...

Definition#include <kfontdialog.h>
InheritsQWidget (qt) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Signals

Public Static Methods

Protected Methods


Detailed Description

While KFontChooser as an ordinary widget can be embedded in custom dialogs and therefore is very flexible, in most cases it is preferable to use the convenience functions in KFontDialog.

enum FontColumn { FamilyList=0x01, StyleList=0x02, SizeList=0x04, CharsetList=0x08 }

FontColumn

enum FontDiff { FontDiffFamily=0x01, FontDiffStyle=0x02, FontDiffSize=0x04 }

FontDiff

 KFontChooser (QWidget *parent = 0L, const char *name = 0L, bool onlyFixed = false, const QStringList &fontList = QStringList(), bool makeFrame = true, int visibleListSize=8, bool diff = false, QButton::ToggleState *sizeIsRelativeState = 0L )

KFontChooser

Constructs a font picker widget. It normally comes up with all font families present on the system; the getFont method below does allow some more fine-tuning of the selection of fonts that will be displayed in the dialog.

Consider the following code snippet;

QStringList list; KFontChooser::getFontList(list,SmoothScalableFonts); KFontChooser chooseFont = new KFontChooser(0, "FontList", false, list);

The above creates a font chooser dialog with only SmoothScaleble fonts.

Parameters:
parentThe parent widget.
nameThe widget name.
onlyFixedFontsOnly display fonts which have fixed-width character sizes.
fontListA 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.
diffDisplay the difference version dialog. See KFontDialog::getFontDiff().
visibleListSizeThe minimum number of visible entries in the fontlists.
sizeIsRelativeStateIf 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().

 ~KFontChooser ()

~KFontChooser

[virtual]

Destructs the font chooser.

void  enableColumn ( int column, bool state )

enableColumn

Enables or disable a font column in the chooser.

Use this function if your application does not need or supports all font properties.

Parameters:
fontSpecifie the columns. An or'ed combination of FamilyList, StyleList and SizeList is possible.
stateIf false the columns are disabled.

void  setFont ( const QFont &font, bool onlyFixed = false )

setFont

Sets the currently selected font in the chooser.

Parameters:
fontThe font to select.
onlyFixedReadjust the font list to display only fixed width fonts if true, or vice-versa.

int  fontDiffFlags ()

fontDiffFlags

Returns: The bitmask corresponding to the attributes the user wishes to change.

QFont  font ()

font

[const]

Returns: The currently selected font in the chooser.

void  setColor ( const QColor & col )

setColor

Sets the color to use in the preview.

QColor  color ()

color

[const]

Returns: The color currently used in the preview (default: black)

void  setBackgroundColor ( const QColor & col )

setBackgroundColor

Sets the background color to use in the preview.

QColor  backgroundColor ()

backgroundColor

[const]

Returns: The background color currently used in the preview (default: white)

void  setSizeIsRelative ( QButton::ToggleState relative )

setSizeIsRelative

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 widget this setting will be ignored.

QButton::ToggleState  sizeIsRelative ()

sizeIsRelative

[const]

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

void  setCharset ( const QString & charset )

setCharset

Set the currently selected charset in the chooser.

QString  charset ()

charset

[const]

Returns: The currently selected charset in the dialog.

QString  sampleText ()

sampleText

[const]

Returns: The current text in the sample text input area.

void  setSampleText ( const QString &text )

setSampleText

Sets the sample text.

Normally you should not change this text, but it can be better to do this if the default text is too large for the edit area when using the default font of your application.

Parameters:
textThe new sample text. The current will be removed.

QString  getXLFD ( const QFont &theFont )

getXLFD

[static]

Converts a QFont into the corresponding X Logical Font Description (XLFD).

Parameters:
theFontThe font to convert.

Returns: A string representing the given font in XLFD format.

enum FontListCriteria { FixedWidthFonts=0x01, ScalableFonts=0x02, SmoothScalableFonts=0x04 }

FontListCriteria

The selection criteria for the font families shown in the dialog.

void  getFontList ( QStringList &list, uint fontListCriteria)

getFontList

[static]

Creates a list of font strings.

Parameters:
listThe list is returned here.
fontListCriteriashould contain all the restrictions for font selection as OR-ed values

See also: FontListCriteria, for, the, individual, values

QSize  sizeHint ( void )

sizeHint

[const virtual]

Reimplemented for internal reasons.

void  fontSelected ( const QFont &font )

fontSelected

[signal]

Emitted whenever the selected font changes.

void  virtual_hook ( int id, void* data )

virtual_hook

[protected virtual]