QElectroTech  0.8-dev
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ProjectDBModel Class Reference

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.

Collaboration diagram for ProjectDBModel:
Collaboration graph

Public Member Functions

 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...
 
QETProjectproject () 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
 

Static Public Member Functions

static QString xmlTagName ()
 

Private Member Functions

void dataBaseUpdated ()
 ProjectDBModel::dataBaseUpdated slot called when the project database is updated. More...
 
void setHeaderString ()
 
void fillValue ()
 

Private Attributes

QPointer< QETProjectm_project
 
QString m_query
 
QVector< QStringList > m_record
 
QHash< int, QHash< int, QVariant > > m_header_data
 
QHash< int, QVariant > m_index_0_0_data
 
QString m_identifier = "unknow"
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ProjectDBModel() [1/2]

ProjectDBModel::ProjectDBModel ( QETProject project,
QObject *  parent = nullptr 
)
explicit

ProjectDBModel::ProjectDBModel.

Parameters
project:project of this nomenclature
parent: parent QObject
Here is the call graph for this function:

◆ ProjectDBModel() [2/2]

ProjectDBModel::ProjectDBModel ( const ProjectDBModel other_model)
explicit

ProjectDBModel::ProjectDBModel.

Parameters
other_model
Here is the call graph for this function:

Member Function Documentation

◆ columnCount()

int ProjectDBModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

ProjectDBModel::columnCount Reimplemented for QAbstractTableModel.

Parameters
parent
Returns

◆ data()

QVariant ProjectDBModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

ProjectDBModel::data Reimplemented for QAbstractTableModel.

Parameters
index
role
Returns

◆ dataBaseUpdated()

void ProjectDBModel::dataBaseUpdated ( )
private

ProjectDBModel::dataBaseUpdated slot called when the project database is updated.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fillValue()

void ProjectDBModel::fillValue ( )
private
Here is the caller graph for this function:

◆ fromXml()

void ProjectDBModel::fromXml ( const QDomElement &  element)

ProjectDBModel::fromXml Restore the model from xml.

Parameters
element
Here is the call graph for this function:

◆ headerData()

QVariant ProjectDBModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

ProjectDBModel::headerData Reimplemented from QAbstractTableModel.

Parameters
section
orientation
role
Returns

◆ identifier()

QString ProjectDBModel::identifier ( ) const
inline
Here is the caller graph for this function:

◆ project()

QETProject * ProjectDBModel::project ( ) const
Here is the caller graph for this function:

◆ queryString()

QString ProjectDBModel::queryString ( ) const

ProjectDBModel::queryString.

Returns
the current query used by this model
Here is the caller graph for this function:

◆ rowCount()

int ProjectDBModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

ProjectDBModel::rowCount Reimplemented for QAbstractTableModel.

Parameters
parent
Returns

◆ setData()

bool ProjectDBModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

ProjectDBModel::setData Only store the data for the index 0.0.

Parameters
index
value
role
Returns

◆ 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
Here is the caller graph for this function:

◆ setHeaderString()

void ProjectDBModel::setHeaderString ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setIdentifier()

void ProjectDBModel::setIdentifier ( const QString &  identifier)

ProjectDBModel::setIdentifier Set the identifier of this model to identifier.

Parameters
identifier
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setQuery()

void ProjectDBModel::setQuery ( const QString &  query)

ProjectDBModel::setQuery Query the internall bd with query.

Parameters
query
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
document
Returns
Here is the call graph for this function:

◆ xmlTagName()

static QString ProjectDBModel::xmlTagName ( )
inlinestatic
Here is the caller graph for this function:

Member Data Documentation

◆ 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

QPointer<QETProject> ProjectDBModel::m_project
private

◆ 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: