【发布时间】:2016-06-26 21:05:12
【问题描述】:
每当我尝试创建一个新的 QWebView 时,构建后错误是
QWidget: Must construct a QApplication before a QPaintDevice
为什么会这样?
是的,我确实在 pro 文件中添加了QT += webkit,它在此处显示
在 qwtconfig.pri 中
CONFIG += QwtDll 这行必须是->
#CONFIG += QwtDll
qtwconfig.pri 在哪里?
FWI 我正在静态构建中
这里是main()
#include "MyWidget.h"
#include <QPlastiqueStyle>
#include <QtPlugin>
#include <QtWebKit/QWebView>
Q_IMPORT_PLUGIN(qico)
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setStyle(new QPlastiqueStyle);
app.setFont(QFont("Calibri"));
MyWidget widget;
widget.show();
QWebView w;
w.show();
return app.exec();
}
【问题讨论】: