1、在.pro文件上加上
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
2、更改相应头文件头文件比如#include <QtGui/QApplication> 改为 #include <QApplication>