![]() |
QElectroTech 0.200.1-dev
|
The projectDataBase class This class wraps a sqlite data base where you can find several things about the content of a project. More...
#include <projectdatabase.h>
Inherits QObject.

Signals | |
| void | dataBaseUpdated () |
Private Slots | |
| void | conductorPropertiesChanged () |
| projectDataBase::conductorPropertiesChanged | |
Private Member Functions | |
| bool | createDataBase () |
| projectDataBase::createDataBase Create the data base | |
| void | createElementNomenclatureView () |
| projectDataBase::createElementNomenclatureView | |
| void | createSummaryView () |
| projectDataBase::createSummaryView | |
| void | populateDiagramTable () |
| void | populateElementTable () |
| projectDataBase::populateElementTable Populate the element table | |
| void | populateElementInfoTable () |
| projectDataBase::populateElementInfoTable Populate the element info table | |
| void | populateDiagramInfoTable () |
| void | populateConductorTable () |
| projectDataBase::populateConductorTable Populate the terminal and conductor tables. Terminals only matter here in the context of a conductor referencing them, so their population is folded into this method rather than tracked independently. | |
| void | bindConductorValues (QSqlQuery &query, Conductor *conductor, Diagram *diagram) |
| projectDataBase::bindConductorValues One binder for both insert paths, so a conductor added to a live diagram and one read from a file can never drift apart – the same reason bindElementValues() exists for elements. | |
| void | watchConductor (Conductor *conductor) |
| projectDataBase::watchConductor Keep this conductor's row in step with its properties. | |
| void | insertTerminal (Terminal *terminal) |
| projectDataBase::insertTerminal Insert (or, if already present – e.g. a junction shared by several conductors – silently keep) @terminal in the terminal table. | |
| void | prepareQuery () |
| void | bindDiagramInfoValues (QSqlQuery &query, Diagram *diagram) |
Static Private Member Functions | |
| static QHash< QString, QString > | elementInfoToString (Element *elmt) |
| projectDataBase::elementInfoToString | |
Private Attributes | |
| QPointer< QETProject > | m_project |
| QSqlDatabase | m_data_base |
| QSqlQuery | m_insert_elements_query |
| QSqlQuery | m_insert_element_info_query |
| QSqlQuery | m_remove_element_query |
| QSqlQuery | m_update_element_query |
| QSqlQuery | m_insert_diagram_query |
| QSqlQuery | m_remove_diagram_query |
| QSqlQuery | m_insert_diagram_info_query |
| QSqlQuery | m_update_diagram_info_query |
| QSqlQuery | m_diagram_order_changed |
| QSqlQuery | m_diagram_info_order_changed |
| QSqlQuery | m_insert_terminal_query |
| QSqlQuery | m_insert_conductor_query |
| QSqlQuery | m_update_conductor_query |
| QSqlQuery | m_remove_conductor_query |
| QSqlQuery | m_cascade_remove_element_info_query |
| QSqlQuery | m_cascade_remove_terminal_query |
| QSqlQuery | m_cascade_remove_conductor_query |
| QSqlQuery | m_cascade_remove_element_query |
The projectDataBase class This class wraps a sqlite data base where you can find several things about the content of a project.
| projectDataBase::projectDataBase | ( | QETProject * | project, |
| QObject * | parent = nullptr ) |
projectDataBase::projectDataBase Default constructor
| project | : project from the database work |
| parent | : parent QObject |

|
overridevirtual |
projectDataBase::~projectDataBase Destructor
| void projectDataBase::addConductor | ( | Conductor * | conductor | ) |
| void projectDataBase::addDiagram | ( | Diagram * | diagram | ) |


| void projectDataBase::addElement | ( | Element * | element | ) |
|
private |
projectDataBase::bindConductorValues One binder for both insert paths, so a conductor added to a live diagram and one read from a file can never drift apart – the same reason bindElementValues() exists for elements.
| query | |
| conductor | |
| diagram | : the diagram the conductor belongs to |


|
private |


|
privateslot |
projectDataBase::conductorPropertiesChanged


|
private |
projectDataBase::createDataBase Create the data base


|
private |
|
private |
|
signal |

| void projectDataBase::diagramInfoChanged | ( | Diagram * | diagram | ) |


| void projectDataBase::diagramOrderChanged | ( | ) |
| void projectDataBase::elementInfoChanged | ( | Element * | element | ) |
projectDataBase::elementInfoChanged
| element |


| void projectDataBase::elementInfoChanged | ( | QList< Element * > | elements | ) |

|
staticprivate |
projectDataBase::elementInfoToString
| elmt |


|
private |
projectDataBase::insertTerminal Insert (or, if already present – e.g. a junction shared by several conductors – silently keep) @terminal in the terminal table.
| terminal |


| QSqlQuery projectDataBase::newQuery | ( | const QString & | query = QString() | ) |

|
private |
projectDataBase::populateConductorTable Populate the terminal and conductor tables. Terminals only matter here in the context of a conductor referencing them, so their population is folded into this method rather than tracked independently.


|
private |


|
private |

|
private |
projectDataBase::populateElementInfoTable Populate the element info table


|
private |
projectDataBase::populateElementTable Populate the element table


|
private |


| QETProject * projectDataBase::project | ( | ) | const |

| void projectDataBase::removeConductor | ( | Conductor * | conductor | ) |
| void projectDataBase::removeDiagram | ( | Diagram * | diagram | ) |


| void projectDataBase::removeElement | ( | Element * | element | ) |
| void projectDataBase::updateConductor | ( | Conductor * | conductor | ) |
projectDataBase::updateConductor Refresh the mutable columns of an already-inserted conductor.
Only the text (the wire number) can change without the conductor being removed and re-added: its endpoints are fixed for its lifetime. Without this, renaming a wire left the database holding the old number and the wiring list showed a stale value until the next full repopulate.
| conductor |


| void projectDataBase::updateDB | ( | ) |
projectDataBase::updateDB Up to date the content of the data base. Emit the signal dataBaseUpdated


|
private |
projectDataBase::watchConductor Keep this conductor's row in step with its properties.
Conductor::setProperties() has a dozen call sites (auto-numbering, the properties dialog, element moves, deletion re-links...), so listening to the signal it already emits is the only way to catch them all – and the only way to catch the ones added later. Qt::UniqueConnection makes a repeated insert or a full repopulate harmless.
| conductor |


|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |