Stellarium  0.17.0
Public Member Functions
FieldConcatModel Class Reference

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)
 

Detailed Description

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.

Author
Timothy Reaves

Constructor & Destructor Documentation

FieldConcatModel::FieldConcatModel ( QSqlTableModel *  backingModel,
QStringList  fieldNames,
QString  seperationString = " | ",
QObject *  parent = 0 
)
Parameters
backingModelthe model this modul uses as a source of data.
fieldNamesa list of the names of the fields to be concatinated. The fields are used in the order they are in the list.
seperationStringthe string used to seperate the fields values. Defaults to " | ".
parentthe parent of this object.