Skip to content

Commit

Permalink
Qt6: use new QSqlField constructor with QMetaType
Browse files Browse the repository at this point in the history
[56/585] Building CXX object CMakeFiles/mixxx-lib.dir/src/dialog/dlgreplacecuecolor.cpp.o
In file included from ../src/dialog/dlgreplacecuecolor.cpp:12:
../src/library/queryutil.h: In constructor ‘FieldEscaper::FieldEscaper(const QSqlDatabase&)’:
../src/library/queryutil.h:77:15: warning: ‘QSqlField::QSqlField(const QString&, QVariant::Type, const QString&)’ is deprecated: Use the constructor using a QMetaType instead [-Wdeprecated-declarations]
   77 |               m_stringField("string", QVariant::String) {
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt6/QtSql/QtSql:9,
                 from ../src/library/queryutil.h:4,
                 from ../src/dialog/dlgreplacecuecolor.cpp:12:
/usr/include/qt6/QtSql/qsqlfield.h:85:5: note: declared here
   85 |     QSqlField(const QString& fieldName, QVariant::Type type, const QString &tableName = QString())
      |     ^~~~~~~~~
  • Loading branch information
Be-ing committed Oct 12, 2021
1 parent 44a1e4f commit 2037f73
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/library/queryutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class FieldEscaper final {
public:
FieldEscaper(const QSqlDatabase& database)
: m_database(database),
m_stringField("string", QVariant::String) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_stringField("string", QMetaType(QMetaType::QString)) {
#else
m_stringField("string", QVariant::String){
#endif
}

// Escapes a string for use in a SQL query by wrapping with quotes and
Expand Down

0 comments on commit 2037f73

Please sign in to comment.