C++ Qt 4.6和4.7之间QString类的变化

C++ Qt 4.6和4.7之间QString类的变化,c++,constructor,qt4,overloading,C++,Constructor,Qt4,Overloading,我现在尝试使用Qt 4.7进行编译,在编译运行时,我收到了他的错误: g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt

我现在尝试使用Qt 4.7进行编译,在编译运行时,我收到了他的错误:

g++ -c -pipe -O2 -Wall -W -DQT_NO_DEBUG -DQT_QT3SUPPORT_LIB -DQT3_SUPPORT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/share/qt4/mkspecs/freebsd-g++ -I. -I/usr/local/include/qt4/QtCore -I/usr/local/include/qt4/QtGui -I/usr/local/include/qt4/Qt3Support -I/usr/local/include/qt4 -Isqlite_source -I.moc -I/usr/local/include -o .obj/extendedmainform.o extendedmainform.cpp
In file included from findform.h:24,
                 from form1.h:31,
                 from extendedmainform.h:4,
                 from extendedmainform.cpp:1:
sqlitedb.h: In constructor 'DBBrowserField::DBBrowserField()':
sqlitedb.h:44: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note:                 QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
sqlitedb.h: In constructor 'DBBrowserIndex::DBBrowserIndex()':
sqlitedb.h:58: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note:                 QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
sqlitedb.h: In constructor 'DBBrowserTable::DBBrowserTable()':
sqlitedb.h:73: error: call of overloaded 'QString(int)' is ambiguous
/usr/local/include/qt4/QtCore/qstring.h:428: note: candidates are: QString::QString(const QByteArray&)
/usr/local/include/qt4/QtCore/qstring.h:426: note:                 QString::QString(const char*)
/usr/local/include/qt4/QtCore/qstring.h:728: note:                 QString::QString(const QString&)
/usr/local/include/qt4/QtCore/qstring.h:106: note:                 QString::QString(QChar)
/usr/local/include/qt4/QtCore/qstring.h:105: note:                 QString::QString(const QChar*)
*** Error code 1

我查看了Qt文档(4.6和4.7)以查看Qstring构造函数中的任何更改,但我只看到了一个新的,所以我的问题是,为了编译它,我需要在sqlitebrowser中更改什么。

无论您在何处创建带有int的Qstring,您都需要告诉Qt int是什么意思


如果要转换为字符串的是实际的文字数字,请使用QString(“%u”).arg()函数

创建带有int的QString时,您需要告诉Qt int是什么意思

如果它是要转换为字符串的实际文字数,请使用QString(“%u”).arg()函数,根据,只有一个函数可以将指针作为参数。但中有两个QString构造函数可以将指针作为参数。我认为这引发了编译器错误

您可以强制它像Qt 4.6那样运行,如下所示:

name((const char*) 0)
根据,只有一个函数可以将指针作为参数。但中有两个QString构造函数可以将指针作为参数。我认为这引发了编译器错误

您可以强制它像Qt 4.6那样运行,如下所示:

name((const char*) 0)

sqlitedb.h第44行:'DBBrowserField():name(0){}'默认初始化将执行相同的操作,因此您可以忽略
:name(0)
sqlitedb.h第44行:'DBBrowserField():name(0){}默认初始化将执行相同的操作,因此您可以忽略
:name(0)
默认初始化将执行相同的操作,所以他可以省略
:name(0)
默认初始化也会做同样的事情,所以他可以省略
:name(0)