LibEngsas
|
A delegate to display and edit foreign keys from SQL tables. More...
#include <edelegateforeignkey.h>
Public Member Functions | |
EDelegateForeignKey (QString table, QString matchColumn, QString resultColumn, QWidget *parent=0) | |
EDelegateForeignKey (QString table, QString matchColumn, QString resultColumn, QString(*translator)(const QString), QWidget *parent=0) | |
Constructor to supply an translator callback. More... | |
void | setTranslator (QString(*translator)(const QString)) |
void | reloadForeignKeys () |
void | paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const |
QWidget * | createEditor (QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const |
void | setEditorData (QWidget *editor, const QModelIndex &index) const |
void | setModelData (QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const |
Private Slots | |
void | commitAndCloseEditor () |
void | doCloseEditor () |
void | updateCompleter () |
Private Member Functions | |
void | init (QString table, QString matchColumn, QString resultColumn) |
Private Attributes | |
QMap< QString, unsigned int > | mapOutIn |
QString | resTable |
QString | matchCol |
QString | resCol |
QSqlQueryModel * | resultModel |
int | maxComboItems |
int | maxCompleteItems |
bool | useComboBox |
bool | useCompleter |
bool | useExtendedCompleter |
QTimer * | timer |
QString(* | translator )(const QString) |
A delegate to display and edit foreign keys from SQL tables.
If there are more than maxComboItems, it switches to QLineEdit with autocompletion if there are more than maxCompleteItems, it loads the completer after 3 inserted characters to reduce load.
To translate the mapped function, set the translator callback to an apropriate function with setTranslator() or the related constructor.
last one is not useable right now
use ESqlDatabase if it is available
The completer model does not support translations yet
EDelegateForeignKey::EDelegateForeignKey | ( | QString | table, |
QString | matchColumn, | ||
QString | resultColumn, | ||
QWidget * | parent = 0 |
||
) |
table | the table where the foreignkey points to |
matchColumn | the column which is the same in showed table and foreignkey table (at table table ) |
resultColumn | the column at the foreignkey table which holds the content to be displayed |
EDelegateForeignKey::EDelegateForeignKey | ( | QString | table, |
QString | matchColumn, | ||
QString | resultColumn, | ||
QString(*)(const QString) | translator, | ||
QWidget * | parent = 0 |
||
) |
Constructor to supply an translator callback.
|
privateslot |
QWidget * EDelegateForeignKey::createEditor | ( | QWidget * | parent, |
const QStyleOptionViewItem & | , | ||
const QModelIndex & | |||
) | const |
|
privateslot |
|
private |
void EDelegateForeignKey::paint | ( | QPainter * | painter, |
const QStyleOptionViewItem & | option, | ||
const QModelIndex & | index | ||
) | const |
void EDelegateForeignKey::reloadForeignKeys | ( | ) |
void EDelegateForeignKey::setEditorData | ( | QWidget * | editor, |
const QModelIndex & | index | ||
) | const |
void EDelegateForeignKey::setModelData | ( | QWidget * | editor, |
QAbstractItemModel * | model, | ||
const QModelIndex & | index | ||
) | const |
void EDelegateForeignKey::setTranslator | ( | QString(*)(const QString) | translator | ) |
|
privateslot |
|
private |
the QString, int order is needed, because the entries should be ordered after the string's
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Function callback to translate QString into QString.
|
private |
|
private |
|
private |