Qt5.14.2版本中QString的用法(最新版)

本文详细介绍了QString类的各种使用方法,包括构造函数、字符串拼接、插入、判断空值、数字与字符串转换、长度获取、字符索引访问、比较、查找、包含判断、字符串分割等,是Qt开发中QString操作的全面指南。

看了之前大牛写的博客,发现很多函数方法在当前版本迭代中失效了,有的直接删掉,有的更新换名字了。今天写了半个下午,把常用的都整理好了。太累了~

1、QString构造函数

    QString str("hello");
    QString str = QString("hello");	//效率不高,一般配用正则表达式.arg()
    QString str = "hello";

2、添加字符(串) / append

//原型
    inline QT_ASCII_CAST_WARN QString &append(const char *s)
    { return append(QString::fromUtf8(s)); }
//示例
	QString  str("hello world");
    str.append("!!!");
    qDebug() << str;		//"hello world!!!"

3、添加字符(串) / +=

//原型
    inline QT_ASCII_CAST_WARN QString &operator+=(const char *s)
    { return append(QString::fromUtf8(s)); }
//示例
    QString  str("hello");
    str +=  " world";
    qDebug() << str;		//"hello world"

4、插入字符(串) / insert

//原型
    inline QT_ASCII_CAST_WARN QString &insert(int i, const char *s)
    { return insert(i, QString::fromUtf8(s)); }
//示例
    QString  str("hello world!");
    str.insert(str.length()-1," I like it ");
    qDebug() << str;		//"hello world I like it!"

5、判断是否为空、NULL

	str.isNull();
    str.isEmpty();
    QString str;
    qDebug() << str.isNull() << str.isEmpty();	//true true
    QString str("");
    qDebug() << str.isNull() << str.isEmpty();	//false true

6、数字 -> 字符串 / QString::number

//原型
    static QString number(int, int base=10);
    static QString number(uint, int base=10);
    static QString number(long, int base=10);
    static QString number(ulong, int base=10);
    static QString number(qlonglong, int base=10);
    static QString number(qulonglong, int base=10);
    static QString number(double, char f='g', int prec=6);
    //默认base = 10,说明是十进制转换, base在[2,36]之间
//示例
    int data = 2020;
    QString  str = QString::number(data);
    qDebug() << str;		//"2020"

7、字符串 -> 数字 / toInt、toDouble、toFloat

//部分原型
	short  toShort(bool *ok=nullptr, int base=10) const;
    ushort toUShort(bool *ok=nullptr, int base=10) const;
    int toInt(bool *ok=nullptr, int base=10) const;
    uint toUInt(bool *ok=nullptr, int base=10) const;
    long toLong(bool *ok=nullptr, int base=10) const;
    ulong toULong(bool *ok=nullptr, int base=10) const;
    qlonglong toLongLong(bool *ok=nullptr, int base=10) const;
    qulonglong toULongLong(bool *ok=nullptr, int base=10) const;
    float toFloat(bool *ok=nullptr) const;
    double toDouble(bool *ok=nullptr) const;
    //默认base = 10,说明是十进制转换, base在[2,36]之间
//示例
    QString  str("2020");
    int data = str.toInt();
    std::cout << data << std::endl;		//2020

    QString  str("2020.323232");
    int data = str.toInt();
    std::cout << data << std::endl;		//0

8、字符串长度 / length

//原型
	inline int QString::length() const
	{ return d->size; }
//示例
//其一
    QString str("hello qt5!!!");
    qDebug() << QString::number(str.length());		//"12"
//其二,根据原型返回值
	QString str("hello qt5!!!");
    qDebug() << QString::number(str.size());		//"12"

9、索引下标 / .at()

//原型
	inline const QChar QString::at(int i) const
	{ Q_ASSERT(uint(i) < uint(size())); return QChar(d->data()[i]); }
	inline const QChar QString::operator[](int i) const
	{ Q_ASSERT(uint(i) < uint(size())); return QChar(d->data()[i]); }
//示例
    QString str("hello qt5!!!");
//其一
    qDebug() << str.at(3) << str.at(4) << str.at(5);		//'l' 'o' ' '
//其二,效率没有其一好
    qDebug() << str[3] << str[4] << str[5];		//'l' 'o' ' '

10、字符(串)比较 / compare

//示例
    int index = QString::compare("acghjh","b");
    qDebug() << QString::number(index);		//"-1"
    
    int index = QString::compare("acghjh","s");
    qDebug() << QString::number(index);		//"-18"
    //多检验几遍就会发现,其实compare就是将‘前一个字符串的第一个字符’与‘后一个字符串的第一个字符’所对应的两个ASCLL码作差并返回差值

11、常规查找字符(串) /indexOf

//原型
	Q_REQUIRED_RESULT int indexOf(QStringView s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
    { return int(QtPrivate::findString(*this, from, s, cs)); } // ### Qt6: qsizetype
//示例
    QString  str("ghjsdsdgswsdgesddssdf");		//随意敲的
    int flag = str.indexOf("sd");		//从0开始查找
    qDebug() << QString::number(flag);		//"3"

    QString  str("ghjsdsdgswsdgesddssdf");		//随意敲的
    int flag = str.indexOf("sd",4);		//从4开始查找,具体查看原型
    qDebug() << QString::number(flag);		//"5"

	//有兴趣可以研究研究  int flag = str.indexOf("sd",-4); 的情形,并想想为什么?

12、反向查找字符(串) / lastIndexOf

//原型
    Q_REQUIRED_RESULT int lastIndexOf(QStringView s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
    { return int(QtPrivate::lastIndexOf(*this, from, s, cs)); } // ### Qt6: qsizetype
//示例
    QString  str("ghjsdsdgswsdgesddssdf");		//随意敲的
    int flag = str.lastIndexOf("sd");
    qDebug() << QString::number(flag);		//"18"

    QString  str("ghjsdsdgswsdgesddssdf");		//随意敲的
    int flag = str.lastIndexOf("sd",-4);		//从最后的倒数第4个字符开始往前遍历
    qDebug() << QString::number(flag);		//"14"

    //同样有兴趣可以试试 int flag = str.lastIndexOf("sd",4);

13、是否包含字符串 / contains

//原型
	inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
	{ return indexOf(s, 0, cs) != -1; }
//示例
    QString  str("ghjsdsdgswsdgesddssdf");
    bool flag = str.contains('s');
    qDebug() << flag;		//true

14、判断开始字符 / startsWith

//示例
    QString  str("ghjsdsdgswsdgesddssdf");
    bool flag = str.startsWith("hjs");
    qDebug() << flag;		//"false"

15、指定覆盖填充 / fill

//部分原型
    QString &fill(QChar c, int size = -1);
//示例
    QString  str("hello world");
    str.fill('!');
    qDebug() << str;		//"!!!!!!!!!!!"

    QString  str("hello world");
    str.fill('!',4);
    qDebug() << str;		//"!!!!"

16、选取左边开始的 n 个字符 / left

//原型
	Q_DECL_CONSTEXPR QLatin1String left(int n) const
    { return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QLatin1String(m_data, n); }
//示例
    QString str("hello world!");
    QString flag = str.left(4);
    qDebug() << flag;		//"hell"

17、选取右边开始的 n 个字符 / right

//原型
	Q_DECL_CONSTEXPR QLatin1String right(int n) const
    { return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QLatin1String(m_data + m_size - n, n); }
//示例
    QString  str("hello world!!!");
    str = str.right(5);
    qDebug() << str;		//"ld!!!"

18、从中选取n个字符 / mid

//原型
	Q_DECL_CONSTEXPR QLatin1String mid(int pos) const
    { return Q_ASSERT(pos >= 0), Q_ASSERT(pos <= size()), QLatin1String(m_data + pos, m_size - pos); }
    Q_DECL_CONSTEXPR QLatin1String mid(int pos, int n) const
    { return Q_ASSERT(pos >= 0), Q_ASSERT(n >= 0), Q_ASSERT(pos + n <= size()), QLatin1String(m_data + pos, n); }
//示例
    QString  str("hello world!!!");
    str = str.mid(3);		//从下标为3开始选取全部
    qDebug() << str;		//"lo world!!!"

    QString  str("hello world!!!");
    str = str.mid(3,6);		//从下标为3开始选取6个字符
    qDebug() << str;		//"lo wor"

19、英文大小写转换 / toLower、toUpper

//原型
	QChar toLower() const { return QChar(*this).toLower(); }
	QChar toUpper() const { return QChar(*this).toUpper(); }
//示例
    QString str("Hello World!");
    str = str.toLower();
    qDebug() << str;		//"hello world!"
    str = str.toUpper();
    qDebug() << str;		//"HELLO WORLD!"

20、消除两端空白字符 / trimmed

//原型
	Q_REQUIRED_RESULT QLatin1String trimmed() const noexcept 
	{ return QtPrivate::trimmed(*this); }
//示例
    QString  str("  hello world!!!  ");
    str = str.trimmed();
    qDebug() << str;		//"hello world!!!"

21、将QString根据特定符号分割成QStringList / split

//原型
	QStringList QString::split(const QString &sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
	{ return split(sep, _sb(behavior), cs); }
	QStringList QString::split(QChar sep, Qt::SplitBehavior behavior, Qt::CaseSensitivity cs) const
	{ return split(sep, _sb(behavior), cs); }
//示例
    QString  str("I am a boy,I am a student,I am a programmer");
    //用“,”做分隔符,‘,’也可,并且分割符不在分割后的成员中
    QStringList list = str.split(",");		
    foreach(QString temp, list)
        qDebug() << temp;
    //"I am a boy"
	//"I am a student"
	//"I am a programmer"

22、移除字符(串) / remove

//部分原型
    QString &remove(int i, int len);
    QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &remove(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive);
//示例
    QString  str("hello world!!!");
    str = str.remove(3,3);		//从索引为3开始,删除3个字符
    qDebug() << str;		//"helworld!!!"

    QString  str("hello world!!!");
    str = str.remove('l');		//删除所有字符‘l'
    qDebug() << str;		//"heo word!!!"

    QString  str("hello world!!!");
    str = str.remove("ll");		//删除所有字符串“ll”
    qDebug() << str;		//"heo world!!!"

23、替换字符(串) / replace

//部分原型
	QString &replace(int i, int len, QChar after);
    QString &replace(int i, int len, const QChar *s, int slen);
    QString &replace(int i, int len, const QString &after);
    QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(QLatin1String before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(const QString &before, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(const QString &before, const QString &after,
                     Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
    QString &replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs = Qt::CaseSensitive);
//示例
    QString  str("hello world!!!");
    str = str.replace(2,2,"LL");		//索引2开始,替换两个字符,替换为“LL”
    qDebug() << str;		//"heLLo world!!!"

    QString  str("hello world!!!");
    str = str.replace("ll","LL");		//替换找到的所有的 “ll” 为 “LL”
    qDebug() << str;		//"heLLo world!!!"

24、正则表达式 / .arg()

//部分原型
    Q_REQUIRED_RESULT QString arg(const QString &a, int fieldWidth = 0, QChar fillChar = QLatin1Char(' ')) const;
//示例
    QString  str = QString("I am a good %1,and I like a %2 in my college.").arg("boy").arg("girl");
    qDebug() << str;		//"I am a good boy,and I like a girl in my college."

25、···

14:38:12: 为项目MainWindowExample执行步骤 ... 14:38:12: 正在启动 "D:\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe" D:\Work\laoliu\cds\resource\MainWindowExample\MainWindowExample.pro -spec win32-g++ "CONFIG+=qtquickcompiler" Info: creating stash file D:\Work\laoliu\cds\resource\build-MainWindowExample-Desktop_Qt_5_14_2_MinGW_64_bit-Release\.qmake.stash 14:38:21: 进程"D:\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe"正常退出。 14:38:21: 正在启动 "D:\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe" -f D:/Work/laoliu/cds/resource/build-MainWindowExample-Desktop_Qt_5_14_2_MinGW_64_bit-Release/Makefile qmake_all mingw32-make: Nothing to be done for 'qmake_all'. 14:38:21: 进程"D:\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe"正常退出。 14:38:21: 正在启动 "D:\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe" -j12 D:/Qt5.14.2/Tools/mingw730_64/bin/mingw32-make -f Makefile.Release mingw32-make[1]: Entering directory 'D:/Work/laoliu/cds/resource/build-MainWindowExample-Desktop_Qt_5_14_2_MinGW_64_bit-Release' Makefile.Release:2822: warning: overriding recipe for target 'release/moc_imageexportthread.cpp' Makefile.Release:2590: warning: ignoring old recipe for target 'release/moc_imageexportthread.cpp' Makefile.Release:4394: warning: overriding recipe for target 'release/moc_OpenWordtemplate.cpp' Makefile.Release:4280: warning: ignoring old recipe for target 'release/moc_OpenWordtemplate.cpp' Makefile.Release:20869: warning: overriding recipe for target 'release/imageexportthread.o' Makefile.Release:11270: warning: ignoring old recipe for target 'release/imageexportthread.o' g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\main.o ..\MainWindowExample\main.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\VerticalLineItem.o ..\MainWindowExample\Custom\graphItem\VerticalLineItem.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\imageexportthread.o ..\MainWindowExample\Custom\module\imageexportthread.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\OnLineDataWidget.o ..\MainWindowExample\OnLineDataWidget.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\qword.o ..\MainWindowExample\Word\qword.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\appevent.o ..\MainWindowExample\appevent.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\common.o ..\MainWindowExample\common.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\configinfo.o ..\MainWindowExample\configinfo.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\dialogabout.o ..\MainWindowExample\dialogabout.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\helpdialog.o ..\MainWindowExample\helpdialog.cpp g++ -c -fno-keep-inline-dllexport -DQT_USE_FFMPEG -O2 -std=gnu++11 -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_SVG_LIB -DQT_AXCONTAINER_LIB -DQT_AXBASE_LIB -DQT_PRINTSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_XML_LIB -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I..\MainWindowExample -I. -I..\MainWindowExample\GL_LIB -I..\MainWindowExample\include -I..\Ribbon\include -I..\MainWindowExample\quazip\include -I..\opencv\include -I..\MainWindowExample\deps\glm32\include -I..\MainWindowExample\deps\freetype32\include\freetype2 -ID:\Qt5.14.2\5.14.2\mingw73_64\include -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimediaWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtMultimedia -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSvg -ID:\Qt5.14.2\5.14.2\mingw73_64\include\ActiveQt -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtPrintSupport -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtGui -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtANGLE -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtNetwork -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtSql -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtXml -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtConcurrent -ID:\Qt5.14.2\5.14.2\mingw73_64\include\QtCore -Irelease -ID:\VulkanSDK\1.3.283.0\include -ID:\Qt5.14.2\5.14.2\mingw73_64\mkspecs\win32-g++ -o release\httpclient.o ..\MainWindowExample\httpclient.cpp In file included from ..\MainWindowExample/datamagr.h:13:0, from ..\MainWindowExample\Custom\module\imageexportthread.cpp:2: ..\MainWindowExample/dataexportmagr.h:159:31: error: 'getExceptionPointMap' function uses 'auto' type specifier without trailing return type auto getExceptionPointMap() { return m_mapExceptionPoint; } ^ ..\MainWindowExample/dataexportmagr.h:159:31: note: deduced return type only available with -std=c++14 or -std=gnu++14 In file included from ..\MainWindowExample\datamagr.h:13:0, from ..\MainWindowExample\ioperation.h:6, from ..\MainWindowExample\mainwindow.h:4, from ..\MainWindowExample\main.cpp:1: ..\MainWindowExample\dataexportmagr.h:159:31: error: 'getExceptionPointMap' function uses 'auto' type specifier without trailing return type auto getExceptionPointMap() { return m_mapExceptionPoint; } ^ ..\MainWindowExample\dataexportmagr.h:159:31: note: deduced return type only available with -std=c++14 or -std=gnu++14 In file included from ..\MainWindowExample\Custom\module\imageexportthread.cpp:2:0: ..\MainWindowExample/datamagr.h:197:27: error: 'getDataExportMap' function uses 'auto' type specifier without trailing return type auto getDataExportMap() { return m_DataExportMap; } ^ ..\MainWindowExample/datamagr.h:197:27: note: deduced return type only available with -std=c++14 or -std=gnu++14 In file included from ..\MainWindowExample\ioperation.h:6:0, from ..\MainWindowExample\mainwindow.h:4, from ..\MainWindowExample\main.cpp:1: ..\MainWindowExample\datamagr.h:197:27: error: 'getDataExportMap' function uses 'auto' type specifier without trailing return type auto getDataExportMap() { return m_DataExportMap; } ^ ..\MainWindowExample\datamagr.h:197:27: note: deduced return type only available with -std=c++14 or -std=gnu++14 mingw32-make[1]: *** [Makefile.Release:20869: release/imageexportthread.o] Error 1 mingw32-make[1]: *** Waiting for unfinished jobs.... ..\MainWindowExample\main.cpp: In function 'int qMain(int, char**)': ..\MainWindowExample\main.cpp:57:54: warning: 'const QRect QDesktopWidget::screenGeometry(int) const' is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] QRect screenRect = desktopWidget->screenGeometry(); ^ In file included from D:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets/QDesktopWidget:1:0, from ..\MainWindowExample\main.cpp:8: D:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets/qdesktopwidget.h:79:67: note: declared here QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect screenGeometry(int screen = -1) const; ^~~~~~~~~~~~~~ ..\MainWindowExample\main.cpp:86:61: warning: 'const QRect QDesktopWidget::availableGeometry(int) const' is deprecated: Use QGuiApplication::screens() [-Wdeprecated-declarations] QRect screenGeometry = desktopWidget->availableGeometry(); ^ In file included from D:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets/QDesktopWidget:1:0, from ..\MainWindowExample\main.cpp:8: D:\Qt5.14.2\5.14.2\mingw73_64\include\QtWidgets/qdesktopwidget.h:88:67: note: declared here QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect availableGeometry(int screen = -1) const; ^~~~~~~~~~~~~~~~~ In file included from ..\MainWindowExample\datamagr.h:13:0, from ..\MainWindowExample\helpdialog.h:6, from ..\MainWindowExample\helpdialog.cpp:1: ..\MainWindowExample\dataexportmagr.h:159:31: error: 'getExceptionPointMap' function uses 'auto' type specifier without trailing return type auto getExceptionPointMap() { return m_mapExceptionPoint; } ^ ..\MainWindowExample\dataexportmagr.h:159:31: note: deduced return type only available with -std=c++14 or -std=gnu++14 In file included from ..\MainWindowExample\helpdialog.h:6:0, from ..\MainWindowExample\helpdialog.cpp:1: ..\MainWindowExample\datamagr.h:197:27: error: 'getDataExportMap' function uses 'auto' type specifier without trailing return type auto getDataExportMap() { return m_DataExportMap; } ^ ..\MainWindowExample\datamagr.h:197:27: note: deduced return type only available with -std=c++14 or -std=gnu++14 mingw32-make[1]: *** [Makefile.Release:12364: release/helpdialog.o] Error 1 mingw32-make[1]: *** [Makefile.Release:10858: release/main.o] Error 1 mingw32-make[1]: Leaving directory 'D:/Work/laoliu/cds/resource/build-MainWindowExample-Desktop_Qt_5_14_2_MinGW_64_bit-Release' mingw32-make: *** [Makefile:45: release] Error 2 14:38:28: 进程"D:\Qt5.14.2\Tools\mingw730_64\bin\mingw32-make.exe"退出,退出代码 2 。 Error while building/deploying project MainWindowExample (kit: Desktop Qt 5.14.2 MinGW 64-bit) When executing step "Make" 14:38:28: Elapsed time: 00:16.
最新发布
11-25
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值