#include "framecapture.h"
#include <iostream>
#include <QtWidget>
int main(int argc, char * argv[])
{
if (argc != 3) {
std::cout << "Capture a web page and save its internal frames in different images" << std::endl << std::endl;
std::cout << " framecapture <url> <outputfile>" << std::endl;
std::cout << std::endl;
std::cout << "Notes:" << std::endl;
std::cout << " 'url' is the URL of the web page to be captured" << std::endl;
std::cout << " 'outputfile' is the prefix of the image files to be generated" << std::endl;
std::cout << std::endl;
std::cout << "Example: " << std::endl;
std::cout << " framecapture qt.nokia.com trolltech.png" << std::endl;
std::cout << std::endl;
std::cout << "Result:" << std::endl;
std::cout << " trolltech.png (full page)" << std::endl;
std::cout << " trolltech_frame1.png (...) trolltech_frameN.png ('N' number of internal frames)" << std::endl;
return 0;
}
QUrl url = QUrl::fromUserInput(QString::fromLatin1(argv[1]));
QString fileName = QString::fromLatin1(argv[2]);
QApplication a(argc, argv);
FrameCapture capture;
QObject::connect(&capture, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
capture.load(url, fileName);
return a.exec();
}
我找不到QtWidget文件或目录。当我使用QWidget时,它会说
/家庭/ ME / QtWebKit的-实例和 - 演示/示例/ webkit的/ framecapture-积聚桌面/../ framecapture / main.cpp中:68: 错误:变量'QApplication a'具有初始化程序但不完整类型
/首页/我/ QtWebKit的-例子-和演示/例子/ WebKit的/ framecapture - 构建 - 桌面/../ framecapture / main.cpp中:70: 错误:嵌套名称说明符
中使用的不完整类型“QApplication”
我不知道为什么 git://gitorious.org/+qt-developers/qt/qtwebkit-examples-and-demos-staging.git 中没有一个例子正常工作。似乎总是抱怨#includes没有找到所需的组件。
答案 0 :(得分:1)
您只需要包含QApplication。那就是:
#include <QApplication>
如果我没弄错的话,那么无论如何都没有<QtWidget>
这样的包含文件。那应该是<QWidget>
。鉴于具体示例,我希望通常包括<QtGui>
。