<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /builddir/build/BUILD/libqxt/src/gui/qxtlookuplineedit.cpp --> <head> <title>QxtLookupLineEdit Class Reference</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="classes.html"><font color="#004faf">Classes</font></a> · <a href="namespaces.html"><font color="#004faf">Namespaces</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtLookupLineEdit Class Reference<br /><span class="small-subtitle">[<a href="http://doc.qtsoftware.com/4.5/qtgui.html">QtGui</a> module]</span> </h1> <p>The QxtLookupLineEdit class is a <a href="http://doc.qtsoftware.com/4.5/qlineedit.html">QLineEdit</a> to select from data provided by a <a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a>. QxtLookupLineEdit uses <a href="qxtfilterdialog.html">QxtFilterDialog</a> to make it easy for the user, to select data from a large dataset. <a href="#details">More...</a></p> <pre> #include <QxtLookupLineEdit></pre><p>Inherits <a href="http://doc.qtsoftware.com/4.5/qlineedit.html">QLineEdit</a>.</p> <ul> <li><a href="qxtlookuplineedit-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"></div><b><a href="qxtlookuplineedit.html#QxtLookupLineEdit">QxtLookupLineEdit</a></b> ( QWidget * <i>parent</i> = 0 )</li> <li><div class="fn"></div><b><a href="qxtlookuplineedit.html#dtor.QxtLookupLineEdit">~QxtLookupLineEdit</a></b> ()</li> <li><div class="fn"></div>int <b><a href="qxtlookuplineedit.html#dataColumn">dataColumn</a></b> () const</li> <li><div class="fn"></div>int <b><a href="qxtlookuplineedit.html#lookupColumn">lookupColumn</a></b> () const</li> <li><div class="fn"></div>int <b><a href="qxtlookuplineedit.html#lookupRole">lookupRole</a></b> () const</li> <li><div class="fn"></div>QKeySequence <b><a href="qxtlookuplineedit.html#popupTrigger">popupTrigger</a></b> () const</li> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#setDataColumn">setDataColumn</a></b> ( const int <i>column</i> )</li> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#setLookupColumn">setLookupColumn</a></b> ( const int <i>column</i> )</li> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#setLookupRole">setLookupRole</a></b> ( const int <i>role</i> )</li> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#setPopupTrigger">setPopupTrigger</a></b> ( const QKeySequence & <i>trigger</i> )</li> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#setSourceModel">setSourceModel</a></b> ( QAbstractItemModel * <i>model</i> )</li> <li><div class="fn"></div>QAbstractItemModel * <b><a href="qxtlookuplineedit.html#sourceModel">sourceModel</a></b> () const</li> </ul> <ul> <li><div class="fn"></div>47 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qlineedit.html#public-functions">QLineEdit</a></li> <li><div class="fn"></div>207 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#public-functions">QWidget</a></li> <li><div class="fn"></div>12 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qpaintdevice.html#public-functions">QPaintDevice</a></li> <li><div class="fn"></div>29 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-functions">QObject</a></li> </ul> <a name="signals"></a> <h3>Signals</h3> <ul> <li><div class="fn"></div>void <b><a href="qxtlookuplineedit.html#selected">selected</a></b> ()</li> </ul> <ul> <li><div class="fn"></div>6 signals inherited from <a href="http://doc.qtsoftware.com/4.5/qlineedit.html#signals">QLineEdit</a></li> <li><div class="fn"></div>1 signal inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#signals">QWidget</a></li> <li><div class="fn"></div>1 signal inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#signals">QObject</a></li> </ul> <a name="protected-functions"></a> <h3>Protected Functions</h3> <ul> <li><div class="fn"></div>virtual void <b><a href="qxtlookuplineedit.html#keyPressEvent">keyPressEvent</a></b> ( QKeyEvent * <i>event</i> )</li> </ul> <ul> <li><div class="fn"></div>4 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qlineedit.html#protected-functions">QLineEdit</a></li> <li><div class="fn"></div>37 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#protected-functions">QWidget</a></li> <li><div class="fn"></div>1 protected function inherited from <a href="http://doc.qtsoftware.com/4.5/qpaintdevice.html#protected-functions">QPaintDevice</a></li> <li><div class="fn"></div>7 protected functions inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-functions">QObject</a></li> </ul> <a name="protected-slots"></a> <h3>Protected Slots</h3> <ul> <li><div class="fn"></div>virtual void <b><a href="qxtlookuplineedit.html#showPopup">showPopup</a></b> ()</li> </ul> <ul> <li><div class="fn"></div>1 protected slot inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#protected-slots">QWidget</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li><div class="fn"></div>16 properties inherited from <a href="http://doc.qtsoftware.com/4.5/qlineedit.html#properties">QLineEdit</a></li> <li><div class="fn"></div>57 properties inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#properties">QWidget</a></li> <li><div class="fn"></div>1 property inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#properties">QObject</a></li> <li><div class="fn"></div>8 public slots inherited from <a href="http://doc.qtsoftware.com/4.5/qlineedit.html#public-slots">QLineEdit</a></li> <li><div class="fn"></div>19 public slots inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#public-slots">QWidget</a></li> <li><div class="fn"></div>1 public slot inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-slots">QObject</a></li> <li><div class="fn"></div>1 public type inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#public-variables">QObject</a></li> <li><div class="fn"></div>4 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qwidget.html#static-public-members">QWidget</a></li> <li><div class="fn"></div>1 static public member inherited from <a href="http://doc.qtsoftware.com/4.5/qpaintdevice.html#static-public-members">QPaintDevice</a></li> <li><div class="fn"></div>4 static public members inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#static-public-members">QObject</a></li> <li><div class="fn"></div>1 protected type inherited from <a href="http://doc.qtsoftware.com/4.5/qpaintdevice.html#protected-variables">QPaintDevice</a></li> <li><div class="fn"></div>2 protected variables inherited from <a href="http://doc.qtsoftware.com/4.5/qobject.html#protected-variables">QObject</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QxtLookupLineEdit class is a <a href="http://doc.qtsoftware.com/4.5/qlineedit.html">QLineEdit</a> to select from data provided by a <a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a>. QxtLookupLineEdit uses <a href="qxtfilterdialog.html">QxtFilterDialog</a> to make it easy for the user, to select data from a large dataset.</p> <pre> QSqlQueryModel *model = new QSqlQueryModel(parent); model->setQuery("Select employeeNr,name,forename,hometown,phone from employees;",dbConnection); QxtLookupLineEdit* edit = new QxtLookupLineEdit(parent); edit->setSourceModel(model); <span class="comment"> //we want to search by name not by nr so use the name column</span> edit->setLookupColumn(1); <span class="comment"> //we need the employeeNr in the lineEdit , so choose col 0 as dataColumn</span> edit->setDataColumn(0); <span class="comment"> //we want to seek the Display Role</span> edit->setLookupRole(Qt::DisplayRole); <span class="comment"> //if the user presses * in the lineEdit open the popup</span> edit->setPopupTrigger(QKeySequence("*"));</pre> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QxtLookupLineEdit"></a>QxtLookupLineEdit::QxtLookupLineEdit ( <a href="http://doc.qtsoftware.com/4.5/qwidget.html">QWidget</a> * <i>parent</i> = 0 )</h3> <h3 class="fn"><a name="dtor.QxtLookupLineEdit"></a>QxtLookupLineEdit::~QxtLookupLineEdit ()</h3> <h3 class="fn"><a name="dataColumn"></a>int QxtLookupLineEdit::dataColumn () const</h3> <p>returns the model column index <a href="qxtlookuplineedit.html">QxtLookupLineEdit</a> will use to get data from the model after the user has chosen the dataset in the popup</p> <p>See also <a href="qxtlookuplineedit.html#setDataColumn">setDataColumn</a>().</p> <h3 class="fn"><a name="keyPressEvent"></a>void QxtLookupLineEdit::keyPressEvent ( <a href="http://doc.qtsoftware.com/4.5/qkeyevent.html">QKeyEvent</a> * <i>event</i> ) <tt> [virtual protected]</tt></h3> <h3 class="fn"><a name="lookupColumn"></a>int QxtLookupLineEdit::lookupColumn () const</h3> <p>returns the column the lineEdit is looking</p> <p>See also setLookupColumn(const int column).</p> <h3 class="fn"><a name="lookupRole"></a>int QxtLookupLineEdit::lookupRole () const</h3> <p>returns the role the lineEdit is looking</p> <p>See also setLookupRole(const int role).</p> <h3 class="fn"><a name="popupTrigger"></a><a href="http://doc.qtsoftware.com/4.5/qkeysequence.html">QKeySequence</a> QxtLookupLineEdit::popupTrigger () const</h3> <p>returns the trigger that opens the popup</p> <p>See also setPopupTrigger and (const QKeySequence &trigger).</p> <h3 class="fn"><a name="selected"></a>void QxtLookupLineEdit::selected () <tt> [signal]</tt></h3> <h3 class="fn"><a name="setDataColumn"></a>void QxtLookupLineEdit::setDataColumn ( const int <i>column</i> )</h3> <p>set the model column index <a href="qxtlookuplineedit.html">QxtLookupLineEdit</a> will use to get data from the model after the user has chosen the dataset in the popup</p> <p>See also <a href="qxtlookuplineedit.html#dataColumn">dataColumn</a>().</p> <h3 class="fn"><a name="setLookupColumn"></a>void QxtLookupLineEdit::setLookupColumn ( const int <i>column</i> )</h3> <p>sets the column wherethe popup dialog searches</p> <p>See also <a href="qxtlookuplineedit.html#lookupColumn">lookupColumn</a>().</p> <h3 class="fn"><a name="setLookupRole"></a>void QxtLookupLineEdit::setLookupRole ( const int <i>role</i> )</h3> <p>sets the model role the popup should use</p> <p>See also <a href="qxtlookuplineedit.html#lookupRole">lookupRole</a>().</p> <h3 class="fn"><a name="setPopupTrigger"></a>void QxtLookupLineEdit::setPopupTrigger ( const <a href="http://doc.qtsoftware.com/4.5/qkeysequence.html">QKeySequence</a> & <i>trigger</i> )</h3> <p>Sets the popup trigger that makes <a href="qxtlookuplineedit.html">QxtLookupLineEdit</a> open the popup dialog</p> <p>See also <a href="qxtlookuplineedit.html#popupTrigger">popupTrigger</a>().</p> <h3 class="fn"><a name="setSourceModel"></a>void QxtLookupLineEdit::setSourceModel ( <a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a> * <i>model</i> )</h3> <p>sets the sourceModel used in the popup dialog</p> <p>See also <a href="qxtlookuplineedit.html#sourceModel">sourceModel</a>().</p> <h3 class="fn"><a name="showPopup"></a>void QxtLookupLineEdit::showPopup () <tt> [virtual protected slot]</tt></h3> <h3 class="fn"><a name="sourceModel"></a><a href="http://doc.qtsoftware.com/4.5/qabstractitemmodel.html">QAbstractItemModel</a> * QxtLookupLineEdit::sourceModel () const</h3> <p>returns the sourceModel</p> <p>See also setSourceModel(QAbstractItemModel *model).</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td align="left">Copyright © 2007-2010 <a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td> <td align="right"><div align="right"> <a href="http://libqxt.org">Qxt</a> 0.6.1</div></td> </tr></table></div></address></body> </html>