The ProjectDBModel class This model is intended to be use with the class projectDataBase and is designed to be displayed by the class QetGraphicsTableItem (but can be use by other view class since it inherit from QAbstractTableModel). This class should be sufficient to display the content of the project data base from a query set by the method void ProjectDBModel::setQuery(const QString &query). The indentifier method is used by widget editor to retrieve the good widget for edit the query. By defaut identifer return the string 'unknow'. You should use setIdentfier method to set your custom identifier. At the time this sentence is written, there is two identifier : nomenclature summary.
More...
#include <projectdbmodel.h>
Inherits QAbstractTableModel.
|
| ProjectDBModel (QETProject *project, QObject *parent=nullptr) |
| ProjectDBModel::ProjectDBModel. More...
|
|
| ProjectDBModel (const ProjectDBModel &other_model) |
| ProjectDBModel::ProjectDBModel. More...
|
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| ProjectDBModel::rowCount Reimplemented for QAbstractTableModel. More...
|
|
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| ProjectDBModel::columnCount Reimplemented for QAbstractTableModel. More...
|
|
bool | setHeaderData (int section, Qt::Orientation orientation, const QVariant &value, int role=Qt::EditRole) override |
| ProjectDBModel::setHeaderData Reimplemented from QAbstractTableModel. Only horizontal orientation is accepted. More...
|
|
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| ProjectDBModel::headerData Reimplemented from QAbstractTableModel. More...
|
|
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
| ProjectDBModel::setData Only store the data for the index 0.0. More...
|
|
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| ProjectDBModel::data Reimplemented for QAbstractTableModel. More...
|
|
void | setQuery (const QString &setQuery) |
| ProjectDBModel::setQuery Query the internall bd with query. More...
|
|
QString | queryString () const |
| ProjectDBModel::queryString. More...
|
|
QETProject * | project () const |
|
QDomElement | toXml (QDomDocument &document) const |
| ProjectDBModel::toXml Save the model to xml,since model can have unlimited data we only save few data (only these used by qelectrotech). The query, all header data. and some data of index::(0,0). All other data are not saved. More...
|
|
void | fromXml (const QDomElement &element) |
| ProjectDBModel::fromXml Restore the model from xml. More...
|
|
void | setIdentifier (const QString &identifier) |
| ProjectDBModel::setIdentifier Set the identifier of this model to identifier. More...
|
|
QString | identifier () const |
|
The ProjectDBModel class This model is intended to be use with the class projectDataBase and is designed to be displayed by the class QetGraphicsTableItem (but can be use by other view class since it inherit from QAbstractTableModel). This class should be sufficient to display the content of the project data base from a query set by the method void ProjectDBModel::setQuery(const QString &query). The indentifier method is used by widget editor to retrieve the good widget for edit the query. By defaut identifer return the string 'unknow'. You should use setIdentfier method to set your custom identifier. At the time this sentence is written, there is two identifier : nomenclature summary.
◆ ProjectDBModel() [1/2]
ProjectDBModel::ProjectDBModel |
( |
QETProject * |
project, |
|
|
QObject * |
parent = nullptr |
|
) |
| |
|
explicit |
◆ ProjectDBModel() [2/2]
◆ columnCount()
int ProjectDBModel::columnCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ data()
QVariant ProjectDBModel::data |
( |
const QModelIndex & |
index, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
override |
◆ dataBaseUpdated()
void ProjectDBModel::dataBaseUpdated |
( |
| ) |
|
|
private |
◆ fillValue()
void ProjectDBModel::fillValue |
( |
| ) |
|
|
private |
◆ fromXml()
void ProjectDBModel::fromXml |
( |
const QDomElement & |
element | ) |
|
◆ headerData()
QVariant ProjectDBModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole |
|
) |
| const |
|
override |
◆ identifier()
QString ProjectDBModel::identifier |
( |
| ) |
const |
|
inline |
◆ project()
◆ queryString()
QString ProjectDBModel::queryString |
( |
| ) |
const |
◆ rowCount()
int ProjectDBModel::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
override |
◆ setData()
bool ProjectDBModel::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
◆ setHeaderData()
bool ProjectDBModel::setHeaderData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
const QVariant & |
value, |
|
|
int |
role = Qt::EditRole |
|
) |
| |
|
override |
ProjectDBModel::setHeaderData Reimplemented from QAbstractTableModel. Only horizontal orientation is accepted.
- Parameters
-
section | |
orientation | |
value | |
role | |
- Returns
◆ setHeaderString()
void ProjectDBModel::setHeaderString |
( |
| ) |
|
|
private |
◆ setIdentifier()
void ProjectDBModel::setIdentifier |
( |
const QString & |
identifier | ) |
|
◆ setQuery()
void ProjectDBModel::setQuery |
( |
const QString & |
query | ) |
|
◆ toXml()
QDomElement ProjectDBModel::toXml |
( |
QDomDocument & |
document | ) |
const |
ProjectDBModel::toXml Save the model to xml,since model can have unlimited data we only save few data (only these used by qelectrotech). The query, all header data. and some data of index::(0,0). All other data are not saved.
- Parameters
-
- Returns
◆ xmlTagName()
static QString ProjectDBModel::xmlTagName |
( |
| ) |
|
|
inlinestatic |
◆ m_header_data
QHash<int, QHash<int, QVariant> > ProjectDBModel::m_header_data |
|
private |
◆ m_identifier
QString ProjectDBModel::m_identifier = "unknow" |
|
private |
◆ m_index_0_0_data
QHash<int, QVariant> ProjectDBModel::m_index_0_0_data |
|
private |
◆ m_project
◆ m_query
QString ProjectDBModel::m_query |
|
private |
◆ m_record
QVector<QStringList> ProjectDBModel::m_record |
|
private |
The documentation for this class was generated from the following files: