C++ 尝试在安装了QtCreator4的Ubuntu10.10上运行Qt4示例 #包括“framecapture.h” #包括 #包括 int main(int argc,char*argv[]) { 如果(argc!=3){ std::cout
您只需包含QApplication即可。即:C++ 尝试在安装了QtCreator4的Ubuntu10.10上运行Qt4示例 #包括“framecapture.h” #包括 #包括 int main(int argc,char*argv[]) { 如果(argc!=3){ std::cout,c++,qt-creator,C++,Qt Creator,您只需包含QApplication即可。即: #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 i
#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,而不费心包含QApplication。可能是他们使用的是旧版本吗Qt的版本?谢谢!!正如我所期望的(并在我的回答中指出的),该文件实际上包括
,而不是
,正如你在上面的回答中所说的。(我已经从你刚才链接到的git获得了源代码)。所以要么是他们最近更改了它,要么是你编辑了它。包括QtGui将包括所有相关文件,所以应该可以正常工作。
#include <QApplication>