iUser59
9th June 2009, 12:04
Hi,
I've a strange (everyone said me this) problem.
This is my main.cpp
#include <QtGui/QApplication>
#include <QWidget>
#include <QtWebKit>
#include <QWebSettings>
#include <QWebView>
#include <QVBoxLayout>
#include <QUrl>
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
int main(int argc, char *argv[])
{
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);
QApplication a(argc, argv);
QWidget *win = new QWidget();
QVBoxLayout *lay = new QVBoxLayout();
QWebView *web = new QWebView();
QString qstring = QString(QApplication::applicationDirPath());
//qstring += "../../../../.folder/index.html"; // Mac OS X
qstring += "./.folder/index.html"; // Windows
QUrl qurl = QUrl::QUrl(qstring);
web->load(qurl);
web->show();
lay->setContentsMargins(0, 0, 0, 0);
lay->addWidget(web);
win->setLayout(lay);
win->setGeometry(150, 60, 980, 680);
win->show();
return a.exec();
}
In fact, as you can see, I've a cached folder in the same repertory of my .exe (or my .app for MacOS X).
In this folder, I've an index.html and all is working well. The images and the firstframeimage are displaying well but, on windows, the video can be displaying.
In fact, when I test my application with online website, it works well but not with local folder.
I don't know what I'm doing wrong.
Can someone help me?
I've a strange (everyone said me this) problem.
This is my main.cpp
#include <QtGui/QApplication>
#include <QWidget>
#include <QtWebKit>
#include <QWebSettings>
#include <QWebView>
#include <QVBoxLayout>
#include <QUrl>
#include <QtPlugin>
Q_IMPORT_PLUGIN(qjpeg)
int main(int argc, char *argv[])
{
QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true);
QWebSettings::globalSettings()->setAttribute(QWebSettings::AutoLoadImages, true);
QApplication a(argc, argv);
QWidget *win = new QWidget();
QVBoxLayout *lay = new QVBoxLayout();
QWebView *web = new QWebView();
QString qstring = QString(QApplication::applicationDirPath());
//qstring += "../../../../.folder/index.html"; // Mac OS X
qstring += "./.folder/index.html"; // Windows
QUrl qurl = QUrl::QUrl(qstring);
web->load(qurl);
web->show();
lay->setContentsMargins(0, 0, 0, 0);
lay->addWidget(web);
win->setLayout(lay);
win->setGeometry(150, 60, 980, 680);
win->show();
return a.exec();
}
In fact, as you can see, I've a cached folder in the same repertory of my .exe (or my .app for MacOS X).
In this folder, I've an index.html and all is working well. The images and the firstframeimage are displaying well but, on windows, the video can be displaying.
In fact, when I test my application with online website, it works well but not with local folder.
I don't know what I'm doing wrong.
Can someone help me?