mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Fix Qt 6 deprecated Qt::SystemLocaleShortDate
The format options Qt::SystemLocaleDate, Qt::SystemLocaleShortDate and Qt::SystemLocaleLongDate shall be removed in Qt 6. Their use should be replaced with QLocale::system().toString(date, QLocale::ShortFormat) or QLocale::system().toString(date, QLocale::LongFormat).
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
#include <QPainter>
|
||||
#include <utility>
|
||||
#include <QLocale>
|
||||
|
||||
#include "titleblocktemplate.h"
|
||||
#include "titleblocktemplaterenderer.h"
|
||||
#include "bordertitleblock.h"
|
||||
@@ -934,9 +936,12 @@ void BorderTitleBlock::updateDiagramContextForTitleBlock(
|
||||
}
|
||||
|
||||
// ... overridden by the historical and/or dynamically generated fields
|
||||
QLocale var;
|
||||
var.dateFormat(QLocale::ShortFormat);
|
||||
context.addValue("author", btb_author_);
|
||||
context.addValue("date", btb_date_.toString(
|
||||
Qt::SystemLocaleShortDate));
|
||||
context.addValue(
|
||||
"date",
|
||||
QLocale::system().toString(btb_date_, QLocale::ShortFormat));
|
||||
context.addValue("title", btb_title_);
|
||||
context.addValue("filename", btb_filename_);
|
||||
context.addValue("plant", btb_plant_);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "diagramposition.h"
|
||||
|
||||
#include <QSqlError>
|
||||
#include <QLocale>
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_WINDOWS)
|
||||
#include <QSqlDriver>
|
||||
@@ -161,7 +162,11 @@ void projectDataBase::addDiagram(Diagram *diagram)
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate));
|
||||
m_insert_diagram_info_query.bindValue(
|
||||
":date",
|
||||
QLocale::system().toString(
|
||||
infos.value("date").toDate(),
|
||||
QLocale::ShortFormat));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
@@ -419,7 +424,11 @@ void projectDataBase::populateDiagramInfoTable()
|
||||
for (auto key : QETApp::diagramInfoKeys())
|
||||
{
|
||||
if (key == "date") {
|
||||
m_insert_diagram_info_query.bindValue(":date", QDate::fromString(infos.value("date").toString(), Qt::SystemLocaleShortDate));
|
||||
m_insert_diagram_info_query.bindValue(
|
||||
":date",
|
||||
QLocale::system().toString(
|
||||
infos.value("date").toDate(),
|
||||
QLocale::ShortFormat));
|
||||
} else {
|
||||
auto value = infos.value(key);
|
||||
auto bind = key.prepend(":");
|
||||
|
||||
@@ -934,13 +934,17 @@ QETResult QETProject::write()
|
||||
return(error_message);
|
||||
|
||||
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
||||
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));
|
||||
m_project_properties.addValue(
|
||||
"saveddate",
|
||||
QDate::currentDate().toString(
|
||||
QLocale::system().toString(
|
||||
QLocale::ShortFormat)));
|
||||
m_project_properties.addValue("savedtime", QDateTime::currentDateTime().toString("HH:mm"));
|
||||
m_project_properties.addValue("savedfilename", QFileInfo(filePath()).baseName());
|
||||
m_project_properties.addValue("savedfilepath", filePath());
|
||||
|
||||
emit(projectInformationsChanged(this));
|
||||
updateDiagramsFolioData();
|
||||
emit(projectInformationsChanged(this));
|
||||
updateDiagramsFolioData();
|
||||
|
||||
setModified(false);
|
||||
return(QETResult());
|
||||
|
||||
Reference in New Issue
Block a user