Stellarium
0.17.0
|
Allows for concatinating fields from a model for disply. More...
#include <FieldConcatModel.hpp>
Public Member Functions | |
FieldConcatModel (QSqlTableModel *backingModel, QStringList fieldNames, QString seperationString=" | ", QObject *parent=0) | |
the default constructor More... | |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
QString | displayStringForRecord (QSqlRecord &record) const |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
int | idForDisplayString (QString displayString) |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
void | setFilter (const QString &filter) |
This class allows a table model to concatinate fields for the purpose of display. Qt widgets that accept default Qt models allow the user to specify which column's value to use for display purposes, but only one column can be used. Here, the user can provide a list of column - field - names to use, as well as a string to use to seperate the columns. As this model is intended for list and combo box selection, it is read-only. If any of the fields values are invalid or empty, they are skipped in the concatination operation, and the seperator as well.
FieldConcatModel::FieldConcatModel | ( | QSqlTableModel * | backingModel, |
QStringList | fieldNames, | ||
QString | seperationString = " | " , |
||
QObject * | parent = 0 |
||
) |
backingModel | the model this modul uses as a source of data. |
fieldNames | a list of the names of the fields to be concatinated. The fields are used in the order they are in the list. |
seperationString | the string used to seperate the fields values. Defaults to " | ". |
parent | the parent of this object. |