| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KLineEditDlg Class Reference

Dialog for user to enter a single line of text. More...

`#include <klineeditdlg.h>`

Inheritance diagram for KLineEditDlg:

[legend]
Collaboration diagram for KLineEditDlg:

[legend]
List of all members.

## Public Slots
void | slotClear ()
| Clears the edit widget.
## Public Member Functions
| KLineEditDlg (const QString &_text, const QString &_value, QWidget *parent)
| Create a dialog that asks for a single line of text.
QString | text () const
KLineEdit * | lineEdit () const
## Static Public Member Functions
QString | getText (const QString &_text, const QString &_value, bool *ok, QWidget *parent, QValidator *validator=0)
| Static convenience function to get a textual input from the user.
QString | getText (const QString &_caption, const QString &_text, const QString &_value=QString::null, bool *ok=0, QWidget *parent=0, QValidator *validator=0)
| Static convenience function to get a textual input from the user.
## Protected Slots
void | slotTextChanged (const QString &)
| Enables and disables the OK button depending on the state returned by the lineedit's QValidator.
## Protected Member Functions
virtual void | virtual_hook (int id, void *data)
## Protected Attributes
KLineEdit * | edit
| The line edit widget.

## Detailed Description

Dialog for user to enter a single line of text.

Version:
  Id
    klineeditdlg.h,v 1.13 2002/03/04 00:51:50 lunakl Exp

Author:
  David Faure <faure@kde.org>, layout management by Preston Brown <pbrown@kde.org>

Definition at line 35 of file klineeditdlg.h.

## Constructor & Destructor Documentation

KLineEditDlg::KLineEditDlg | ( | const QString & | _text,
|  | const QString & | _value,
|  | QWidget * | parent
| ) |

  | Create a dialog that asks for a single line of text. _value is the initial value of the line. _text appears as label on top of the entry box. If the internal line edit has an associated QValidator set, the OK button is disabled as long as the validator doesn't return Acceptable. If there's no validator, the OK button is enabled whenever the line edit isn't empty. If you want to accept empty input, make a trivial QValidator that always returns Acceptable, e.g. QRegExpValidator with a regexp of ".*". Parameters:
  _text | Text of the label
  _value | Initial value of the inputline
Definition at line 37 of file klineeditdlg.cpp. References edit, KDialogBase::enableButton(), KDialogBase::enableButtonOK(), QString::isEmpty(), KStdAccel::label(), KDialogBase::plainPage(), QLineEdit::setSelection(), QLineEdit::setText(), QLineEdit::sizeHint(), slotClear(), slotTextChanged(), KDialog::spacingHint(), QLineEdit::text(), and KDialogBase::user1Clicked().

## Member Function Documentation

QString KLineEditDlg::text | ( |  | ) | const

| Returns: the value the user entered Definition at line 154 of file klineeditdlg.cpp. References edit, and QLineEdit::text(). Referenced by getText().

KLineEdit* KLineEditDlg::lineEdit | ( |  | ) | const`[inline]`

| Returns: the line edit widget Definition at line 65 of file klineeditdlg.h. References edit. Referenced by getText().

QString KLineEditDlg::getText | ( | const QString & | _text,
|  | const QString & | _value,
|  | bool * | ok,
|  | QWidget * | parent,
|  | QValidator * | validator = 0
| ) | `[static]`

  | Static convenience function to get a textual input from the user. Parameters:
  _text | Text of the label
  _value | Initial value of the inputline
  ok | this bool will be set to true if user pressed "Ok"
  _validator | Validator to be stuffed into the line edit.
Definition at line 159 of file klineeditdlg.cpp. References QDialog::exec(), lineEdit(), QLineEdit::setValidator(), slotTextChanged(), and text().

QString KLineEditDlg::getText | ( | const QString & | _caption,
|  | const QString & | _text,
|  | const QString & | _value = QString::null,
|  | bool * | ok = 0,
|  | QWidget * | parent = 0,
|  | QValidator * | validator = 0
| ) | `[static]`

  | Static convenience function to get a textual input from the user. This method includes a caption, and has (almost) the same API as QInputDialog::getText (no echo mode, we have KPasswordDialog). Parameters:
  _caption | Caption of the dialog
  _text | Text of the label
  _value | Initial value of the inputline
  ok | this bool will be set to true if user pressed "Ok"
  _validator | Validator to be stuffed into the line edit.
Definition at line 174 of file klineeditdlg.cpp. References QDialog::exec(), lineEdit(), KDialog::setCaption(), QLineEdit::setValidator(), slotTextChanged(), and text().

void KLineEditDlg::slotClear | ( |  | ) | `[slot]`

| Clears the edit widget. Definition at line 134 of file klineeditdlg.cpp. References edit, and QLineEdit::setText(). Referenced by KLineEditDlg().

void KLineEditDlg::slotTextChanged | ( | const QString & |  | ) | `[protected, slot]`

| Enables and disables the OK button depending on the state returned by the lineedit's QValidator. Definition at line 139 of file klineeditdlg.cpp. References QLineEdit::cursorPosition(), edit, KDialogBase::enableButton(), KDialogBase::enableButtonOK(), QString::isEmpty(), QString::length(), QLineEdit::text(), and QLineEdit::validator(). Referenced by getText(), and KLineEditDlg().

## Member Data Documentation

KLineEdit* KLineEditDlg::edit`[protected]`

| The line edit widget. Definition at line 111 of file klineeditdlg.h. Referenced by KLineEditDlg(), lineEdit(), slotClear(), slotTextChanged(), and text().

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

- klineeditdlg.h
- klineeditdlg.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:02:04 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001