Skip to content

Commit

Permalink
qt6: Handle QVariant changes in services API.
Browse files Browse the repository at this point in the history
Need to create a null QVariant slightly differently in the Qt6
API. Create it once and use in multiple places, instead of creating it
anew each time.
  • Loading branch information
linuxdude42 committed Apr 29, 2021
1 parent 8f5edb4 commit e913b5a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions mythtv/programs/mythbackend/services/myth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,24 +538,25 @@ DTC::LogMessageList *Myth::GetLogs( const QString &HostName,
}
sql.append(" ORDER BY msgtime ASC;");

#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QVariant ullNull = QVariant(QVariant::ULongLong);
#else
QVariant ullNull = QVariant(QMetaType(QMetaType::ULongLong));
#endif
query.prepare(sql);

query.bindValue(":HOSTNAME", (HostName.isEmpty()) ? QString() : HostName);
query.bindValue(":APPLICATION", (Application.isEmpty()) ? QString() :
Application);
query.bindValue(":PID", ( PID == 0 ) ? QVariant(QVariant::ULongLong) :
(qint64)PID);
query.bindValue(":TID", ( TID == 0 ) ? QVariant(QVariant::ULongLong) :
(qint64)TID);
query.bindValue(":PID", ( PID == 0 ) ? ullNull : (qint64)PID);
query.bindValue(":TID", ( TID == 0 ) ? ullNull : (qint64)TID);
query.bindValue(":THREAD", (Thread.isEmpty()) ? QString() : Thread);
query.bindValue(":FILENAME", (Filename.isEmpty()) ? QString() : Filename);
query.bindValue(":LINE", ( Line == 0 ) ? QVariant(QVariant::ULongLong) :
(qint64)Line);
query.bindValue(":LINE", ( Line == 0 ) ? ullNull : (qint64)Line);
query.bindValue(":FUNCTION", (Function.isEmpty()) ? QString() : Function);
query.bindValue(":FROMTIME", (FromTime.isValid()) ? FromTime : QDateTime());
query.bindValue(":TOTIME", (ToTime.isValid()) ? ToTime : QDateTime());
query.bindValue(":LEVEL", (Level.isEmpty()) ?
QVariant(QVariant::ULongLong) :
query.bindValue(":LEVEL", (Level.isEmpty()) ? ullNull :
(qint64)logLevelGet(Level));

if (!MsgContains.isEmpty())
Expand Down

0 comments on commit e913b5a

Please sign in to comment.