Здравствуйте, гость ( Вход | Регистрация )
klochec_v | Дата 18.12.2007, 14:36 |
да хотел броузер сделать так что бы он работал как обычнве браузеры, без локальной копии файла, чтоб грузил файл с сервера, в 3 версии библиотеки не получается нифига, сроки поджимают, и я воспользовался QAxWidget вставил эксплойер от винды и все...........вся кроссплатформенность к черту...ну ничего допишу проект перейду на 4 версию там вроде бы как(не пробовал) есть такая возможность) |
|
ViGOur | Дата 18.12.2007, 9:14 |
не получается на прямую........... Что ты имеешь ввиду? |
|
klochec_v | Дата 18.12.2007, 0:15 |
:angry: не получается на прямую........... :angry: |
|
klochec_v | Дата 16.12.2007, 21:41 |
Что было? Как исправил? использовал QHttp::done(); вобщем тестовая версия которая загружает странички из инета: CODE //browser.h #ifndef _browser_h_ #define _browser_h_ #include <qwidget.h> class QTextBrowser; class QLineEdit; class QString; class QFile; class QHttp; class QLabel; class Browser: public QWidget { Q_OBJECT public: Browser(QWidget* parent = 0, const char* = 0); public slots: void slNewAddress(); void slShow(bool); private: QTextBrowser* b; QLineEdit* l; QFile* f; QLabel* lbl; QHttp* h; //signals: //void sgAddress(); }; #endif// //browser.cpp #include "browser.h" #include <qhttp.h> #include <qfile.h> #include <qtextbrowser.h> #include <qlabel.h> #include <qlineedit.h> #include <qstring.h> #include <qlayout.h> #include <qmime.h> #include <iostream> using namespace std; Browser::Browser(QWidget* parent,const char* name) :QWidget(parent,name) { f = new QFile("current.htm"); b = new QTextBrowser(this); h = new QHttp("10.5.10.100"); lbl = new QLabel("address: ",this); l = new QLineEdit(this); QVBoxLayout* vbx = new QVBoxLayout(this); QHBoxLayout* hbx = new QHBoxLayout(); hbx->addWidget(lbl); lbl->resize(80,20); hbx->addWidget(l); vbx->addLayout(hbx); vbx->addWidget(; this->resize(1000,600); connect(l,SIGNAL(returnPressed()),this,SLOT(slNewAddress())); connect(h,SIGNAL(done(bool)),this,SLOT(slShow(bool))); l->setFocus(); b->setSource("current.htm"); } //******************************************************************************** **********// void Browser::slNewAddress() { f->open(IO_WriteOnly); h->setHost(l->text()); h->get("/index.htm",f); } //******************************************************************************** **********// void Browser::slShow(bool bo) { f->flush(); f->close(); //h->closeConnection(); b->mimeSourceFactory()->addFilePath("D:\\[_Developer]\\=Code=\\Qtest\\"); b->reload(); std::cout<<bo<<endl; } //******************************************************************************** **********// очевидно что страницы криво грузятся, ну там без рисунков, и т.д. но мне для проекта нужен только текст это просто проверка. возможность проверял. а вообще конечно не верю чтоб нельзя было напрямую в браузер грузить..... |
|
ViGOur | Дата 16.12.2007, 21:20 |
Что было? Как исправил? | |
klochec_v | Дата 16.12.2007, 20:10 |
получилось вроде. будем тестить.... | |
ViGOur | Дата 16.12.2007, 17:12 |
Может все дело в том, что QHttp::get работает асинхронно? Цитата int QHttp::get ( const QString & path, QIODevice * to = 0 ) Sends a get request for path to the server set by setHost() or as specified in the constructor. path must be an absolute path like /index.html or an absolute URI like h t t p://www.trolltech.com/index.html. If the IO device to is 0 the readyRead() signal is emitted every time new content data is available to read. If the IO device to is not 0, the content data of the response is written directly to the device. Make sure that the to pointer is valid for the duration of the operation (it is safe to delete it when the requestFinished() signal is emitted). The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously. The function returns a unique identifier which is passed by requestStarted() and requestFinished(). When the request is started the requestStarted() signal is emitted. When it is finished the requestFinished() signal is emitted. |
|
klochec_v | Дата 16.12.2007, 16:51 |
не помогло.все равно файл только после закрытия программы становится заполенным страничкой... | |
klochec_v | Дата 16.12.2007, 16:47 |
Перед f->close() попробуй сделать f->flush(). И не забывай насчет:
не забыл уже, забыл .... написать после последней строчки. сейчас попробую. |
|
ViGOur | Дата 16.12.2007, 16:41 |
Перед f->close() попробуй сделать f->flush(). И не забывай насчет:
|
|
Просмотр темы полностью (откроется в новом окне) | |
Текстовая версия | Сейчас: 27.4.2024, 20:50 |