Merge branch 'qt6/fix-qsqlquery-copy-warnings' into main
Merge fixes for QSqlQuery deprecation and Qt6 warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
commit
8b1e103ab4
7 files changed
+36
-20
No files matched your search
@@ -47,7 +47,8 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
||||
prefix.truncate(6);
|
||||
|
||||
QByteArray idc = id.toUtf8();
|
||||
quint16 idNum = qChecksum(idc.constData(), idc.size());
|
||||
// Use QByteArrayView overload to avoid deprecated qChecksum overload
|
||||
quint16 idNum = qChecksum(QByteArrayView(idc));
|
||||
socketName = QLatin1String("qtsingleapp-") + prefix
|
||||
+ QLatin1Char('-') + QString::number(idNum, 16);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ NSqlQuery::NSqlQuery(const QString &query, const QSqlDatabase &db, NGL::INGLLogg
|
||||
void NSqlQuery::addBindValue(const QVariant &val, QSql::ParamType paramType)
|
||||
{
|
||||
DB_TRACE;
|
||||
DEBUG_LOG(mLogger) << "type: " << val.type() << " paramType: " << paramType;
|
||||
DEBUG_LOG(mLogger) << "type: " << QString::fromLatin1(val.typeName()) << " paramType: " << paramType;
|
||||
QSqlQuery::addBindValue(val, paramType);
|
||||
}
|
||||
|
||||
@@ -74,14 +74,14 @@ int NSqlQuery::at() const
|
||||
void NSqlQuery::bindValue(const QString &placeholder, const QVariant &val, QSql::ParamType paramType)
|
||||
{
|
||||
DB_TRACE;
|
||||
TRACE_LOG(mLogger) << "placeholder: " << placeholder << " type: " << val.type() << " paramType: " << paramType;
|
||||
TRACE_LOG(mLogger) << "placeholder: " << placeholder << " type: " << QString::fromLatin1(val.typeName()) << " paramType: " << paramType;
|
||||
QSqlQuery::bindValue(placeholder, val, paramType);
|
||||
}
|
||||
|
||||
void NSqlQuery::bindValue(int pos, const QVariant &val, QSql::ParamType paramType)
|
||||
{
|
||||
DB_TRACE;
|
||||
TRACE_LOG(mLogger) << "pos: " << pos << " type: " << val.type() << " paramType: " << paramType;
|
||||
TRACE_LOG(mLogger) << "pos: " << pos << " type: " << QString::fromLatin1(val.typeName()) << " paramType: " << paramType;
|
||||
QSqlQuery::bindValue(pos, val, paramType);
|
||||
}
|
||||
|
||||
@@ -387,7 +387,17 @@ QVariant NSqlQuery::value(int index) const
|
||||
NSqlQuery &NSqlQuery::operator= (const NSqlQuery &other)
|
||||
{
|
||||
DB_TRACE
|
||||
QSqlQuery::operator= (other);
|
||||
// Use move assignment to avoid deprecated copy-assignment of QSqlQuery.
|
||||
// The QSqlQuery copy constructor is deprecated; silence the warning locally.
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
QSqlQuery tmp(other);
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
QSqlQuery::operator=(std::move(tmp));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QTimeZone>
|
||||
|
||||
namespace DTG
|
||||
{
|
||||
@@ -272,7 +273,7 @@ static DTGValidation validate18(const QString &input, QDateTime &dt)
|
||||
|
||||
const int day = input.left(2).toInt();
|
||||
const int year = input.mid(16, 2).toInt() + 2000;
|
||||
dt = QDateTime(QDate(year, month + 1, day), QTime(hh, mm, ss), Qt::UTC);
|
||||
dt = QDateTime(QDate(year, month + 1, day), QTime(hh, mm, ss), QTimeZone::utc());
|
||||
if (!dt.isValid())
|
||||
{
|
||||
|
||||
@@ -313,7 +314,7 @@ static DTGValidation validate7(const QString &input, QDateTime &dt)
|
||||
|
||||
const int day = input.left(2).toInt();
|
||||
const QDate curDate = QDate::currentDate();
|
||||
dt = QDateTime(QDate(curDate.year(), curDate.month(), day), QTime(hh, mm), Qt::UTC);
|
||||
dt = QDateTime(QDate(curDate.year(), curDate.month(), day), QTime(hh, mm), QTimeZone::utc());
|
||||
if (!dt.isValid())
|
||||
{
|
||||
|
||||
|
||||
@@ -198,8 +198,11 @@ bool setTranslationLocale(const QByteArray &isoCode, const QString &qmPrefix)
|
||||
QStringList isoCodeList(QString::fromLatin1(isoCode).split(QLatin1Char('_')));
|
||||
if (isoCodeList.count() == 2)
|
||||
{
|
||||
s_translationData->qtTranslator.load(QLatin1String("qt_") + isoCodeList.at(0),
|
||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
if (!s_translationData->qtTranslator.load(QLatin1String("qt_") + isoCodeList.at(0),
|
||||
QLibraryInfo::path(QLibraryInfo::TranslationsPath)))
|
||||
{
|
||||
qWarning("qtTranslator.load failed for %s", qPrintable(isoCodeList.at(0)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,8 +210,10 @@ bool setTranslationLocale(const QByteArray &isoCode, const QString &qmPrefix)
|
||||
qWarning() << "translation iso code not compatible with qt translations";
|
||||
}
|
||||
|
||||
s_translationData->kdReportsTranslator.load(kdReportsQmPath);
|
||||
s_translationData->ltsTranslator.load(ltsQmPath);
|
||||
if (!s_translationData->kdReportsTranslator.load(kdReportsQmPath))
|
||||
qWarning("kdReportsTranslator.load failed: %s", qPrintable(kdReportsQmPath));
|
||||
if (!s_translationData->ltsTranslator.load(ltsQmPath))
|
||||
qWarning("ltsTranslator.load failed: %s", qPrintable(ltsQmPath));
|
||||
s_translationData->dynamicTranslator.isoCodeChanged(isoCode);
|
||||
|
||||
return !s_translationData->ltsTranslator.isEmpty();
|
||||
|
||||
@@ -20,12 +20,10 @@ NGLMainWindow::NGLMainWindow(QWidget *parent)
|
||||
{
|
||||
m_menu[QLatin1String("File")] = m_menuBar->addMenu(tr("File"));
|
||||
m_fileActionBefore = m_menu[QLatin1String("File")]->addSeparator();
|
||||
m_menu[QLatin1String("File")]->addAction(QIcon(QLatin1String(":/icons/16x16/application-exit.png")), tr("Quit"),
|
||||
this, &NGLMainWindow::onExit, QKeySequence(tr("Ctrl+q")));
|
||||
m_menu[QLatin1String("File")]->addAction(QIcon(QLatin1String(":/icons/16x16/application-exit.png")), tr("Quit"), QKeySequence(tr("Ctrl+q")), this, &NGLMainWindow::onExit);
|
||||
|
||||
m_menu[QLatin1String("Help")] = m_menuBar->addMenu(tr("Help"));
|
||||
m_menu[QLatin1String("Help")]->addAction(QIcon(QLatin1String(":/icons/16x16/help-contents.png")),
|
||||
tr("Help"), this, &NGLMainWindow::onHelpIndex, QKeySequence(tr("F1")));
|
||||
m_menu[QLatin1String("Help")]->addAction(QIcon(QLatin1String(":/icons/16x16/help-contents.png")), tr("Help"), QKeySequence(tr("F1")), this, &NGLMainWindow::onHelpIndex);
|
||||
m_menu[QLatin1String("Help")]->addSeparator();
|
||||
m_menu[QLatin1String("Help")]->addAction(QIcon(QLatin1String(":/icons/16x16/help-about.png")),
|
||||
tr("About"), this, &NGLMainWindow::onHelpAbout);
|
||||
@@ -64,7 +62,7 @@ void NGLMainWindow::onInvokeHelp(const QString &helpContext)
|
||||
<< QCoreApplication::applicationDirPath() + QLatin1String("/../help/scms/") + fn
|
||||
<< QLatin1String("-enableRemoteControl");
|
||||
DEBUG_LOG(m_logger) << "Attempting to invoke help at URL: " << args.join(QLatin1String(" ")) ;
|
||||
m_helpProcess->start(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/assistant"), args);
|
||||
m_helpProcess->start(QLibraryInfo::path(QLibraryInfo::BinariesPath) + QLatin1String("/assistant"), args);
|
||||
if (!m_helpProcess->waitForStarted())
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Could not start help browser (error: "
|
||||
|
||||
@@ -48,7 +48,7 @@ void NGLStandardButton::setType(StandardButton t)
|
||||
case Send:
|
||||
iconName = ":icons/svg/messages.svg";
|
||||
text = tr("&Send");
|
||||
key = QKeySequence(Qt::CTRL + Qt::Key_Return);
|
||||
key = QKeySequence(Qt::CTRL | Qt::Key_Return);
|
||||
objectName = "btnSend";
|
||||
break;
|
||||
case New:
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QTextCodec>
|
||||
#include <QTimer>
|
||||
#include <QVariant>
|
||||
#include <QMetaType>
|
||||
|
||||
|
||||
|
||||
@@ -726,7 +727,7 @@ QSqlRecord QInformixResult::record() const
|
||||
f.setType(qSqlType2Variant(sqlType));
|
||||
f.setSqlType(sqlType);
|
||||
|
||||
if (f.type() == QVariant::Invalid)
|
||||
if (qSqlType2Variant(sqlType) == QVariant::Invalid)
|
||||
qWarning("QInformixResult::record(): Unknown datatype %s", typeName);
|
||||
|
||||
info.append(f);
|
||||
@@ -806,7 +807,7 @@ bool bindValues(T *prep, const QVector<QVariant> &boundValues, const QInformixRe
|
||||
const QVariant &val = boundValues.at(i);
|
||||
ITValue *param = prep->Param(i);
|
||||
|
||||
if (val.type() == QVariant::ByteArray)
|
||||
if (val.metaType().id() == QMetaType::QByteArray)
|
||||
{
|
||||
ITDatum *lobj;
|
||||
|
||||
@@ -870,7 +871,7 @@ bool bindValues(T *prep, const QVector<QVariant> &boundValues, const QInformixRe
|
||||
}
|
||||
else
|
||||
{
|
||||
f.setType(val.type());
|
||||
// setValue() already sets the type appropriately
|
||||
f.setValue(val);
|
||||
if (!param->FromPrintable(p->driverPrivate->toInformixEncoding(driver->formatValue(f))))
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user