Home · Modules · Classes · Namespaces · Functions

QxtLookupLineEdit Class Reference
[QtGui module]

The QxtLookupLineEdit class is a QLineEdit to select from data provided by a QAbstractItemModel. QxtLookupLineEdit uses QxtFilterDialog to make it easy for the user, to select data from a large dataset. More...

    #include <QxtLookupLineEdit>

Inherits QLineEdit.

Public Functions

Signals

Protected Functions

Protected Slots

Additional Inherited Members


Detailed Description

The QxtLookupLineEdit class is a QLineEdit to select from data provided by a QAbstractItemModel. QxtLookupLineEdit uses QxtFilterDialog to make it easy for the user, to select data from a large dataset.

    QSqlQueryModel *model = new QSqlQueryModel(parent);
    model->setQuery("Select employeeNr,name,forename,hometown,phone from employees;",dbConnection);
    QxtLookupLineEdit* edit = new QxtLookupLineEdit(parent);
    edit->setSourceModel(model);
    //we want to search by name not by nr so use the name column
    edit->setLookupColumn(1);
    //we need the employeeNr in the lineEdit , so choose col 0 as dataColumn
    edit->setDataColumn(0);
    //we want to seek the Display Role
    edit->setLookupRole(Qt::DisplayRole);
    //if the user presses * in the lineEdit open the popup
    edit->setPopupTrigger(QKeySequence("*"));

Member Function Documentation

QxtLookupLineEdit::QxtLookupLineEdit ( QWidget * parent = 0 )

QxtLookupLineEdit::~QxtLookupLineEdit ()

int QxtLookupLineEdit::dataColumn () const

returns the model column index QxtLookupLineEdit will use to get data from the model after the user has chosen the dataset in the popup

See also setDataColumn().

void QxtLookupLineEdit::keyPressEvent ( QKeyEvent * event )   [virtual protected]

int QxtLookupLineEdit::lookupColumn () const

returns the column the lineEdit is looking

See also setLookupColumn(const int column).

int QxtLookupLineEdit::lookupRole () const

returns the role the lineEdit is looking

See also setLookupRole(const int role).

QKeySequence QxtLookupLineEdit::popupTrigger () const

returns the trigger that opens the popup

See also setPopupTrigger and (const QKeySequence &trigger).

void QxtLookupLineEdit::selected ()   [signal]

void QxtLookupLineEdit::setDataColumn ( const int column )

set the model column index QxtLookupLineEdit will use to get data from the model after the user has chosen the dataset in the popup

See also dataColumn().

void QxtLookupLineEdit::setLookupColumn ( const int column )

sets the column wherethe popup dialog searches

See also lookupColumn().

void QxtLookupLineEdit::setLookupRole ( const int role )

sets the model role the popup should use

See also lookupRole().

void QxtLookupLineEdit::setPopupTrigger ( const QKeySequence & trigger )

Sets the popup trigger that makes QxtLookupLineEdit open the popup dialog

See also popupTrigger().

void QxtLookupLineEdit::setSourceModel ( QAbstractItemModel * model )

sets the sourceModel used in the popup dialog

See also sourceModel().

void QxtLookupLineEdit::showPopup ()   [virtual protected slot]

QAbstractItemModel * QxtLookupLineEdit::sourceModel () const

returns the sourceModel

See also setSourceModel(QAbstractItemModel *model).


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1