KDE 4.2 PyKDE API Reference

- KDE's Python API

# KRestrictedLine Class Reference

`from PyKDE4.kdeui import *`

Inherits: KLineEdit → QLineEdit → QWidget → QObject

## Detailed Description

A line editor for restricted character sets.

The KRestrictedLine widget is a variant of QLineEdit which accepts only a restricted set of characters as input. All other characters will be discarded and the signal invalidChar() will be emitted for each of them.

Valid characters can be passed as a QString to the constructor or set afterwards via setValidChars(). The default key bindings of QLineEdit are still in effect.

This is almost like setting a QRegExpValidator on a KLineEdit; the difference is that with KRestrictedLine it can all be done in Qt designer.

Author:
  Michael Wiedmann <mw@miwie.in-berlin.de>

## Signals

| invalidChar (int a0)

## Methods

| __init__ (self, QWidget parent=0)
| invalidChar (self, int a0)
| keyPressEvent (self, QKeyEvent e)
| setValidChars (self, QString valid)
QString | validChars (self)

## Method Documentation

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

Constructor: This contructor takes three - optional - arguments. The first two parameters are simply passed on to QLineEdit.

Parameters:

  | parent | pointer to the parent widget

invalidChar | ( | self, |
|  | int | a0
| ) |  |  |

Emitted when an invalid character was typed.

Signal syntax:
  `QObject.connect(source, SIGNAL("invalidChar(int)"), target_slot)`

keyPressEvent | ( | self, |
|  | QKeyEvent | e
| ) |  |  |

setValidChars | ( | self, |
|  | QString | valid
| ) |  |  |

All characters in the string valid are treated as acceptable characters.

QString validChars | ( |  | self ) |

Returns:
  the string of acceptable characters.