mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Improve update of the project database
This commit is contained in:
@@ -182,9 +182,20 @@ void projectDataBase::addDiagram(Diagram *diagram)
|
|||||||
|
|
||||||
if (!m_insert_diagram_info_query.exec()) {
|
if (!m_insert_diagram_info_query.exec()) {
|
||||||
qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError();
|
qDebug() << "projectDataBase::addDiagram insert info error : " << m_insert_diagram_info_query.lastError();
|
||||||
} else {
|
|
||||||
emit dataBaseUpdated();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//The information "folio" of other existing diagram can have the variable %total,
|
||||||
|
//so when a new diagram is added this variable change.
|
||||||
|
//We need to update this information in the database.
|
||||||
|
for (auto diagram : project()->diagrams())
|
||||||
|
{
|
||||||
|
m_diagram_info_order_changed.bindValue(":folio", diagram->border_and_titleblock.titleblockInformation().value("folio"));
|
||||||
|
m_diagram_info_order_changed.bindValue(":uuid", diagram->uuid());
|
||||||
|
if (!m_diagram_info_order_changed.exec()) {
|
||||||
|
qDebug() << "projectDataBase::addDiagram update diagram infp order error : " << m_diagram_info_order_changed.lastError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit dataBaseUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
void projectDataBase::removeDiagram(Diagram *diagram)
|
void projectDataBase::removeDiagram(Diagram *diagram)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ QString SummaryQueryWidget::queryStr() const
|
|||||||
QStringList keys = selectedKeys();
|
QStringList keys = selectedKeys();
|
||||||
|
|
||||||
QString select ="SELECT ";
|
QString select ="SELECT ";
|
||||||
|
QString order_by = " ORDER BY ";
|
||||||
|
|
||||||
QString column;
|
QString column;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -69,13 +70,15 @@ QString SummaryQueryWidget::queryStr() const
|
|||||||
first = false;
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
column += ", ";
|
column += ", ";
|
||||||
|
order_by +=", ";
|
||||||
}
|
}
|
||||||
column += key;
|
column += key;
|
||||||
|
order_by += key;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString from = " FROM project_summary_view";
|
QString from = " FROM project_summary_view";
|
||||||
|
|
||||||
QString q(select + column + from);
|
QString q(select + column + from + order_by);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user