Fix deprecation warnings in QtSql code snippets
Use QMetaType for constructing a QSqlField, fixing: ccode/sqldatabase/sqldatabase.cpp:91:41: warning: ‘QSqlField::QSqlField(const QString&, QVariant::Type)’ is deprecated: Use the constructor using a QMetaType instead [-Wdeprecated-declarations] Change-Id: If420ad3d7f5d9dce05ad892cddf84a1b77a45b3f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
0a4b984421
commit
1f1f000327
@ -80,7 +80,7 @@ void QSqlField_snippets()
|
|||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
//! [2]
|
//! [2]
|
||||||
QSqlField field("age", QVariant::Int);
|
QSqlField field("age", QMetaType::fromType<int>());
|
||||||
field.setValue(QPixmap()); // WRONG
|
field.setValue(QPixmap()); // WRONG
|
||||||
//! [2]
|
//! [2]
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ void QSqlField_snippets()
|
|||||||
|
|
||||||
{
|
{
|
||||||
//! [3]
|
//! [3]
|
||||||
QSqlField field("age", QVariant::Int);
|
QSqlField field("age", QMetaType::fromType<int>());
|
||||||
field.setValue(QString("123")); // casts QString to int
|
field.setValue(QString("123")); // casts QString to int
|
||||||
//! [3]
|
//! [3]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user