Hi
I am compiling a trivial "Hello World" type application that uses WebKit. I am able to browse the web perfectly from any PC with Qt tools installed, but when deploying on a different PC, I can't see any JPEG images.
I initially had side-by-side DLL issues which I resolved (I think). I am using Visual Studio 2005 with SP1. It works on all PC's that I have installed Qt SDK but on any PC that is "non-development", all JPEG images are absent (although I can browse the web).
I have compiled with qtplugin support. In the code below, I test that I can load the plugins using the QPluginLoader object and they successfully load everywhere. Why is it then that WebKit can't seem to find them! I am deploying with the following: Microsoft.VC80.CRT.manifest,msvcp80.dll,msvcr80.dl l,qgif4.dll, qjpeg4.dll, QtCore4.dll, QtGui4.dll,qtiff4.dll, QtNetwork4.dll, QtWebKit4.dll, QtXml4.dll
My source code is below and a complete project containing all the sources is attached.
Note: I have even tried putting the compiled qt sample "C:\Qt\4.4.3\demos\browser\browser.exe" in the same directory and it has the same result - no JPEG images are displayed! (but other than that, it works).
Please Help!
Thanks
Andre
------- HelloWebkit.cpp
#include <QApplication>
#include <QLabel>
#include <QPluginLoader>
#include "MyBrowser.h"
int main(int argc, char* argv[])
{
QString strAppDir
= app.
applicationDirPath();
jpegPluginLoad.load();
if (true==jpegPluginLoad.isLoaded())
{
mb.exec();
}
else
{
QString errorMessage
= jpegPluginLoad.
errorString();
mb.exec();
}
gifPluginLoad.load();
if (true==gifPluginLoad.isLoaded())
{
mb.exec();
}
else
{
QString errorMessage
= gifPluginLoad.
errorString();
mb.exec();
}
CMyBrowser* myBrowser = new CMyBrowser();
myBrowser->show();
return app.exec();
}
#include <QApplication>
#include <QLabel>
#include <QPluginLoader>
#include "MyBrowser.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QString strAppDir = app.applicationDirPath();
QCoreApplication::addLibraryPath(strAppDir);
QPluginLoader jpegPluginLoad("qjpeg4.dll");
jpegPluginLoad.load();
if (true==jpegPluginLoad.isLoaded())
{
QMessageBox mb(QMessageBox::Information,"jpegPluginLoad","jpegPluginLoad plugin was loaded");
mb.exec();
}
else
{
QString errorMessage = jpegPluginLoad.errorString();
QMessageBox mb(QMessageBox::Information,"",errorMessage);
mb.exec();
}
QPluginLoader gifPluginLoad("qgif4.dll");
gifPluginLoad.load();
if (true==gifPluginLoad.isLoaded())
{
QMessageBox mb(QMessageBox::Information,"","gifPluginLoad plugin was loaded");
mb.exec();
}
else
{
QString errorMessage = gifPluginLoad.errorString();
QMessageBox mb(QMessageBox::Information,"gifPluginLoad",errorMessage);
mb.exec();
}
CMyBrowser* myBrowser = new CMyBrowser();
myBrowser->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
---------- MyBrowser.h
#ifndef __MY_BROWSER_H
#define __MY_BROWSER_H
#include <QtGui>
#include <QtWebKit>
{
Q_OBJECT;
public:
CMyBrowser
(QWidget* parent
= NULL);
virtual ~CMyBrowser();
private slots:
void slotLinkClicked(const QUrl& location);
void slotLoadFinished(bool ok);
void slotUnsupportedContent(QNetworkReply* reply);
void slotTitleChanged
(const QString & title
);
protected:
QWebView* m_webkitBrowser;
};
#endif
#ifndef __MY_BROWSER_H
#define __MY_BROWSER_H
#include <QtGui>
#include <QtWebKit>
class CMyBrowser : public QDialog
{
Q_OBJECT;
public:
CMyBrowser(QWidget* parent = NULL);
virtual ~CMyBrowser();
private slots:
void slotLinkClicked(const QUrl& location);
void slotLoadFinished(bool ok);
void slotUnsupportedContent(QNetworkReply* reply);
void slotTitleChanged(const QString & title);
protected:
QWebView* m_webkitBrowser;
};
#endif
To copy to clipboard, switch view to plain text mode
---------- MyBrowser.cpp
CMyBrowser
::CMyBrowser(QWidget* parent
), m_webkitBrowser(NULL)
{
m_webkitBrowser = new QWebView(this);
connect(m_webkitBrowser,
SIGNAL(titleChanged
(const QString &)),
this,
SLOT(slotTitleChanged
(const QString &)));
connect(m_webkitBrowser,
SIGNAL(linkClicked
(const QUrl & )),
this,
SLOT(slotLinkClicked
(const QUrl & )));
connect(m_webkitBrowser, SIGNAL(loadFinished(bool )), this, SLOT(slotLoadFinished(bool )));
connect(m_webkitBrowser->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this,
SLOT(slotUnsupportedContent(QNetworkReply*)));
m_webkitBrowser->page()->setForwardUnsupportedContent(true);
layout->addWidget(m_webkitBrowser);
QString url
("http://www.google.com");
m_webkitBrowser->setUrl(url);
setLayout(layout);
}
CMyBrowser::~CMyBrowser()
{
}
void CMyBrowser::slotLinkClicked(const QUrl& location)
{
}
void CMyBrowser::slotLoadFinished(bool ok)
{
}
void CMyBrowser::slotUnsupportedContent(QNetworkReply* reply)
{
}
void CMyBrowser
::slotTitleChanged(const QString & title
) {
}
CMyBrowser::CMyBrowser(QWidget* parent)
: QDialog(parent)
, m_webkitBrowser(NULL)
{
m_webkitBrowser = new QWebView(this);
connect(m_webkitBrowser, SIGNAL(titleChanged(const QString &)), this, SLOT(slotTitleChanged(const QString &)));
connect(m_webkitBrowser, SIGNAL(linkClicked(const QUrl & )), this, SLOT(slotLinkClicked(const QUrl & )));
connect(m_webkitBrowser, SIGNAL(loadFinished(bool )), this, SLOT(slotLoadFinished(bool )));
connect(m_webkitBrowser->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this,
SLOT(slotUnsupportedContent(QNetworkReply*)));
m_webkitBrowser->page()->setForwardUnsupportedContent(true);
QHBoxLayout* layout = new QHBoxLayout();
layout->addWidget(m_webkitBrowser);
QString url("http://www.google.com");
m_webkitBrowser->setUrl(url);
setLayout(layout);
}
CMyBrowser::~CMyBrowser()
{
}
void CMyBrowser::slotLinkClicked(const QUrl& location)
{
}
void CMyBrowser::slotLoadFinished(bool ok)
{
}
void CMyBrowser::slotUnsupportedContent(QNetworkReply* reply)
{
}
void CMyBrowser::slotTitleChanged(const QString & title)
{
}
To copy to clipboard, switch view to plain text mode
---- HelloWebkit.pro
######################################################################
# Automatically generated by qmake (2.01a) Mon Dec 8 10:55:54 2008
######################################################################
TEMPLATE = app
QT = core gui webkit
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += MyBrowser.h
SOURCES += MyBrowser.cpp \
HelloWebkit.cpp
######################################################################
# Automatically generated by qmake (2.01a) Mon Dec 8 10:55:54 2008
######################################################################
TEMPLATE = app
QT = core gui webkit
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += MyBrowser.h
SOURCES += MyBrowser.cpp \
HelloWebkit.cpp
To copy to clipboard, switch view to plain text mode
Bookmarks