use "%" for string-concatenation

Qt-Docs says it's less memory-usage...
This commit is contained in:
plc-user
2025-05-22 21:33:32 +02:00
parent 3a8e6b16f5
commit ad29893842
30 changed files with 167 additions and 167 deletions

View File

@@ -549,7 +549,7 @@ void projectDataBase::prepareQuery()
//UPDATE DIAGRAM INFO
QString update_diagram_str("UPDATE diagram_info SET ");
for (auto str : QETInformation::diagramInfoKeys()) {
update_diagram_str.append(str + " = :" + str + ", ");
update_diagram_str.append(str % " = :" % str % ", ");
}
update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", "
update_diagram_str.append(" WHERE diagram_uuid = :uuid");
@@ -589,7 +589,7 @@ void projectDataBase::prepareQuery()
//UPDATE ELEMENT INFO
QString update_str("UPDATE element_info SET ");
for (auto string : QETInformation::elementInfoKeys()) {
update_str.append(string + " = :" + string + ", ");
update_str.append(string % " = :" % string % ", ");
}
update_str.remove(update_str.length()-2, 2); //Remove the last ", "
update_str.append(" WHERE element_uuid = :uuid");
@@ -678,7 +678,7 @@ void projectDataBase::exportDb(projectDataBase *db,
if(dir_.isEmpty()) {
dir_ = db->project()->filePath();
if (dir_.isEmpty()) {
dir_ = QETApp::documentDir() + "/" + tr("sans_nom") + ".sqlite";
dir_ = QETApp::documentDir() % "/" % tr("sans_nom") % ".sqlite";
} else {
dir_.remove(".qet");
dir_.append(".sqlite");
@@ -690,7 +690,7 @@ void projectDataBase::exportDb(projectDataBase *db,
return;
}
QString connection_name("export_project_db_" + db->project()->uuid().toString());
QString connection_name("export_project_db_" % db->project()->uuid().toString());
if (true) //Enter in a scope only to nicely use QSqlDatabase::removeDatabase just after the end of the scope
{

View File

@@ -416,7 +416,7 @@ void ElementQueryWidget::setGroupBy(QString text, bool set)
void ElementQueryWidget::setCount(QString text, bool set)
{
if (set) {
m_count = QString(", " + text + " ");
m_count = QString(", " % text % " ");
} else {
m_count.clear();
}
@@ -489,7 +489,7 @@ QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const
*/
void ElementQueryWidget::fillSavedQuery()
{
QFile file(QETApp::configDir() + "/nomenclature.json");
QFile file(QETApp::configDir() % "/nomenclature.json");
if (file.open(QFile::ReadOnly))
{
QJsonDocument jsd(QJsonDocument::fromJson(file.readAll()));
@@ -625,7 +625,7 @@ void ElementQueryWidget::on_m_load_pb_clicked()
return;
}
QFile file_(QETApp::configDir() + "/nomenclature.json");
QFile file_(QETApp::configDir() % "/nomenclature.json");
if (!file_.open(QFile::ReadOnly)) {
return;
}
@@ -650,7 +650,7 @@ void ElementQueryWidget::on_m_load_pb_clicked()
*/
void ElementQueryWidget::on_m_save_current_conf_pb_clicked()
{
QFile file_(QETApp::configDir() + "/nomenclature.json");
QFile file_(QETApp::configDir() % "/nomenclature.json");
if (file_.open(QFile::ReadWrite))
{

View File

@@ -143,7 +143,7 @@ void SummaryQueryWidget::setUpItems()
*/
void SummaryQueryWidget::fillSavedQuery()
{
QFile file(QETApp::configDir() + "/summary.json");
QFile file(QETApp::configDir() % "/summary.json");
if (file.open(QFile::ReadOnly))
{
QJsonDocument jsd(QJsonDocument::fromJson(file.readAll()));
@@ -296,7 +296,7 @@ void SummaryQueryWidget::reset()
*/
void SummaryQueryWidget::saveConfig()
{
QFile file_(QETApp::configDir() + "/summary.json");
QFile file_(QETApp::configDir() % "/summary.json");
if (file_.open(QFile::ReadWrite))
{
@@ -331,7 +331,7 @@ void SummaryQueryWidget::loadConfig()
return;
}
QFile file_(QETApp::configDir() + "/summary.json");
QFile file_(QETApp::configDir() % "/summary.json");
if (!file_.open(QFile::ReadOnly)) {
return;
}