KDE 4.9 PyKDE API Reference

- KDE's Python API

# KFontRequester Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

This class provides a widget with a lineedit and a button, which invokes a font dialog (KFontDialog).

The lineedit provides a preview of the selected font. The preview text can be customized. You can also have the font dialog show only the fixed fonts.

"KDE Font Requester"

Author:
  Nadeem Hasan <nhasan@kde.org>

## Signals
| fontSelected (QFont font)
## Methods
| __init__ (self, QWidget parent=0, bool onlyFixed=0)
| __init__ (self, KFontRequester a0)
QPushButton | button (self)
QFont | font (self)
bool | isFixedOnly (self)
QLabel | label (self)
QString | sampleText (self)
| setFont (self, QFont font, bool onlyFixed=0)
| setSampleText (self, QString text)
| setTitle (self, QString title)
QString | title (self)

## Signal Documentation

fontSelected | ( | QFont | font
| ) |  |  |

Emitted when a new font has been selected in the underlying dialog

Signal syntax:
  `QObject.connect(source, SIGNAL("fontSelected(const QFont&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0,
|  | bool | onlyFixed=0
| ) |  |  |

Constructs a font requester widget.

Parameters:

  | parent | The parent widget.
  | onlyFixed | Only display fonts which have fixed-width character sizes.

__init__ | ( | self, |
|  | KFontRequester | a0
| ) |  |  |

QPushButton button | ( |  | self ) |

Returns:
  Pointer to the pushbutton in the widget.

QFont font | ( |  | self ) |

Returns:
  The currently selected font in the requester.

bool isFixedOnly | ( |  | self ) |

Returns:
  Returns true if only fixed fonts are displayed.

QLabel label | ( |  | self ) |

Returns:
  Pointer to the label used for preview.

QString sampleText | ( |  | self ) |

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

setFont | ( | self, |
|  | QFont | font,
|  | bool | onlyFixed=0
| ) |  |  |

Sets the currently selected font in the requester.

Parameters:

  | font | The font to select.
  | onlyFixed | Display only fixed-width fonts in the font dialog if true, or vice-versa.

setSampleText | ( | self, |
|  | QString | text
| ) |  |  |

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. Default text is current font name and size. Setting the text to QString() will restore the default.

Parameters:

  | text | The new sample text. The current will be removed.

setTitle | ( | self, |
|  | QString | title
| ) |  |  |

Set the title for the widget that will be used in the tooltip and what's this text.

Parameters:

  | title | The title to be set.

QString title | ( |  | self ) |

Returns:
  The current title of the widget.