Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#include<qapplication.h>
#include<qtextbrowser.h>
#include<qlabel.h>
#include<qstring.h>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QWidget *mywidget = new QWidget;
QTextBrowser browser = new QTextBrowser(0);
browser.setSource(QString("http://tw.yahoo.com"));
app.setMainWidget(mywidget);
mywidget->show();
return app.exec();
}
|

|
|
Source code |
1 2 3 4 |
QTextBrowser browser; browser.setSource( QString( "http://tw.yahoo.com" ) ); app.setMainWidget( &browser ); browser.show(); |
|
|
Source code |
1 2 3 4 |
QTextBrowser *browser = new QTextBrowser(); browser->setSource( QString( "http://tw.yahoo.com" ) ); app.setMainWidget( browser ); browser->show(); |
Quoted
Originally posted by note1
When I execute it some message dispaly
QTextBrowser: no mimesource for http://tw.yahoo.com
Quoted
Originally posted by note1
First:I should use Qhttp or Qftp to download the webpage in my hard disk
Second:I use QMimeSourceFactory to read the webpage in my hard disk??
|
|
Source code |
1 |
browser.setSource( QApplication::applicationDirPath() + "/test.html" ); |
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#include<qapplication.h>
#include<qtextbrowser.h>
#include<qlabel.h>
#include<qhttp.h>
#include<qfile.h>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QWidget *mywidget = new QWidget;
//QTextBrowser *browser = new QTextBrowser;
QHttp *http = new QHttp();
QFile *file = new QFile("index.html");
http->setHost("http://tw.yahoo.com");
http->get("index.html",&file);
app.setMainWidget(mywidget);
mywidget->show();
return app.exec();
}
|
Quoted
Originally posted by note1
What should I do??![]()
![]()
|
|
Source code |
1 |
http->get("index.html",&file);
|
Quoted
Originally posted by note1
the same error when compiler...
|
|
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#include<qapplication.h>
#include<qtextbrowser.h>
#include<qlabel.h>
#include<qstring.h>
#include<qhttp.h>
#include<qfile.h>
#include<qurloperator.h>
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QWidget *mywidget = new QWidget;
//QTextBrowser *browser = new QTextBrowser;
QHttp *http = new QHttp();
QFile *file = new QFile("index.html");
http->setHost("http://tw.yahoo.com");
http->get("index.html",file);
app.setMainWidget(mywidget);
mywidget->show();
return app.exec();
}
|
|
|
Source code |
1 2 |
http->setHost( QString( "tw.yahoo.com" ) ); http->get( QString( "index.html" ), file ); |
Quoted
Originally posted by note1
Un~I try it.But the same error.
Quoted
Quoted
Can you give me this file "qhttp.h" ?