mirror of
https://github.com/tnodir/fort
synced 2024-11-15 10:45:10 +00:00
UI: Fix QVariant::type() usage for Qt 6.0
This commit is contained in:
parent
27dd62ea27
commit
c2ce99bbe3
33
src/ui/3rdparty/sqlite/sqlitestmt.cpp
vendored
33
src/ui/3rdparty/sqlite/sqlitestmt.cpp
vendored
@ -75,27 +75,34 @@ bool SqliteStmt::bindBlob(int index, const QByteArray &data)
|
|||||||
|
|
||||||
bool SqliteStmt::bindVar(int index, const QVariant &v)
|
bool SqliteStmt::bindVar(int index, const QVariant &v)
|
||||||
{
|
{
|
||||||
const qint16 vType = v.type();
|
const qint16 vType =
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
v.type();
|
||||||
|
#else
|
||||||
|
v.metaType().id();
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (vType) {
|
switch (vType) {
|
||||||
case QVariant::Invalid:
|
case QMetaType::UnknownType:
|
||||||
|
case QMetaType::Void:
|
||||||
|
case QMetaType::Nullptr:
|
||||||
return bindNull(index);
|
return bindNull(index);
|
||||||
case QVariant::Bool:
|
case QMetaType::Bool:
|
||||||
case QVariant::Int:
|
case QMetaType::Int:
|
||||||
case QVariant::UInt:
|
case QMetaType::UInt:
|
||||||
return bindInt(index, v.toInt());
|
return bindInt(index, v.toInt());
|
||||||
case QVariant::LongLong:
|
case QMetaType::LongLong:
|
||||||
case QVariant::ULongLong:
|
case QMetaType::ULongLong:
|
||||||
return bindInt64(index, v.toLongLong());
|
return bindInt64(index, v.toLongLong());
|
||||||
case QVariant::Double:
|
case QMetaType::Double:
|
||||||
return bindDouble(index, v.toDouble());
|
return bindDouble(index, v.toDouble());
|
||||||
case QVariant::String: {
|
case QMetaType::QString: {
|
||||||
return bindText(index, v.toString());
|
return bindText(index, v.toString());
|
||||||
}
|
}
|
||||||
case QVariant::DateTime: {
|
case QMetaType::QDateTime: {
|
||||||
return bindDateTime(index, v.toDateTime());
|
return bindDateTime(index, v.toDateTime());
|
||||||
}
|
}
|
||||||
case QVariant::ByteArray: {
|
case QMetaType::QByteArray: {
|
||||||
return bindBlob(index, v.toByteArray());
|
return bindBlob(index, v.toByteArray());
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -108,7 +115,7 @@ bool SqliteStmt::bindVar(int index, const QVariant &v)
|
|||||||
// Write content
|
// Write content
|
||||||
{
|
{
|
||||||
switch (vType) {
|
switch (vType) {
|
||||||
case QVariant::Image: {
|
case QMetaType::QImage: {
|
||||||
QByteArray bufData;
|
QByteArray bufData;
|
||||||
|
|
||||||
QBuffer buf(&bufData);
|
QBuffer buf(&bufData);
|
||||||
@ -259,7 +266,7 @@ QVariant SqliteStmt::columnVar(int column)
|
|||||||
// Load content
|
// Load content
|
||||||
{
|
{
|
||||||
switch (vType) {
|
switch (vType) {
|
||||||
case QVariant::Image: {
|
case QMetaType::QImage: {
|
||||||
QByteArray bufData;
|
QByteArray bufData;
|
||||||
stream >> bufData;
|
stream >> bufData;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user