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:
Simon De Backer
2020-09-21 20:23:20 +02:00
parent f21cdb4040
commit c7ffae7918
3 changed files with 82 additions and 64 deletions

View File

@@ -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(":");