Results 1 to 5 of 5

Thread: WekKit won't load JPEG images.

  1. #1

    Default WekKit won't load JPEG images.

    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

    Qt Code:
    1. #include <QApplication>
    2. #include <QLabel>
    3.  
    4. #include <QPluginLoader>
    5.  
    6. #include "MyBrowser.h"
    7.  
    8. int main(int argc, char* argv[])
    9. {
    10. QApplication app(argc, argv);
    11.  
    12. QString strAppDir = app.applicationDirPath();
    13. QCoreApplication::addLibraryPath(strAppDir);
    14.  
    15. QPluginLoader jpegPluginLoad("qjpeg4.dll");
    16. jpegPluginLoad.load();
    17. if (true==jpegPluginLoad.isLoaded())
    18. {
    19. QMessageBox mb(QMessageBox::Information,"jpegPluginLoad","jpegPluginLoad plugin was loaded");
    20. mb.exec();
    21. }
    22. else
    23. {
    24. QString errorMessage = jpegPluginLoad.errorString();
    25. QMessageBox mb(QMessageBox::Information,"",errorMessage);
    26. mb.exec();
    27. }
    28.  
    29. QPluginLoader gifPluginLoad("qgif4.dll");
    30. gifPluginLoad.load();
    31. if (true==gifPluginLoad.isLoaded())
    32. {
    33. QMessageBox mb(QMessageBox::Information,"","gifPluginLoad plugin was loaded");
    34. mb.exec();
    35. }
    36. else
    37. {
    38. QString errorMessage = gifPluginLoad.errorString();
    39. QMessageBox mb(QMessageBox::Information,"gifPluginLoad",errorMessage);
    40. mb.exec();
    41. }
    42.  
    43. CMyBrowser* myBrowser = new CMyBrowser();
    44. myBrowser->show();
    45. return app.exec();
    46. }
    To copy to clipboard, switch view to plain text mode 

    ---------- MyBrowser.h

    Qt Code:
    1. #ifndef __MY_BROWSER_H
    2. #define __MY_BROWSER_H
    3.  
    4. #include <QtGui>
    5. #include <QtWebKit>
    6.  
    7. class CMyBrowser : public QDialog
    8. {
    9. Q_OBJECT;
    10. public:
    11. CMyBrowser(QWidget* parent = NULL);
    12. virtual ~CMyBrowser();
    13.  
    14. private slots:
    15. void slotLinkClicked(const QUrl& location);
    16. void slotLoadFinished(bool ok);
    17. void slotUnsupportedContent(QNetworkReply* reply);
    18. void slotTitleChanged(const QString & title);
    19.  
    20. protected:
    21. QWebView* m_webkitBrowser;
    22. };
    23.  
    24. #endif
    To copy to clipboard, switch view to plain text mode 

    ---------- MyBrowser.cpp



    Qt Code:
    1. CMyBrowser::CMyBrowser(QWidget* parent)
    2. : QDialog(parent)
    3. , m_webkitBrowser(NULL)
    4. {
    5. m_webkitBrowser = new QWebView(this);
    6.  
    7. connect(m_webkitBrowser, SIGNAL(titleChanged(const QString &)), this, SLOT(slotTitleChanged(const QString &)));
    8. connect(m_webkitBrowser, SIGNAL(linkClicked(const QUrl & )), this, SLOT(slotLinkClicked(const QUrl & )));
    9. connect(m_webkitBrowser, SIGNAL(loadFinished(bool )), this, SLOT(slotLoadFinished(bool )));
    10. connect(m_webkitBrowser->page(), SIGNAL(unsupportedContent(QNetworkReply*)), this,
    11. SLOT(slotUnsupportedContent(QNetworkReply*)));
    12. m_webkitBrowser->page()->setForwardUnsupportedContent(true);
    13.  
    14. QHBoxLayout* layout = new QHBoxLayout();
    15. layout->addWidget(m_webkitBrowser);
    16. QString url("http://www.google.com");
    17. m_webkitBrowser->setUrl(url);
    18. setLayout(layout);
    19. }
    20.  
    21. CMyBrowser::~CMyBrowser()
    22. {
    23. }
    24.  
    25. void CMyBrowser::slotLinkClicked(const QUrl& location)
    26. {
    27. }
    28.  
    29.  
    30. void CMyBrowser::slotLoadFinished(bool ok)
    31. {
    32. }
    33.  
    34.  
    35. void CMyBrowser::slotUnsupportedContent(QNetworkReply* reply)
    36. {
    37. }
    38.  
    39. void CMyBrowser::slotTitleChanged(const QString & title)
    40. {
    41. }
    To copy to clipboard, switch view to plain text mode 

    ---- HelloWebkit.pro

    Qt Code:
    1. ######################################################################
    2. # Automatically generated by qmake (2.01a) Mon Dec 8 10:55:54 2008
    3. ######################################################################
    4.  
    5. TEMPLATE = app
    6. QT = core gui webkit
    7. TARGET =
    8. DEPENDPATH += .
    9. INCLUDEPATH += .
    10.  
    11. # Input
    12. HEADERS += MyBrowser.h
    13.  
    14. SOURCES += MyBrowser.cpp \
    15. HelloWebkit.cpp
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by wysota; 9th December 2008 at 12:25. Reason: missing [code] tags

  2. #2
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: WekKit won't load JPEG images.

    Here your new running main
    qt load self all image plug-in
    you must only copy path
    %QTDIR%\plugins\imageformats to applicationpath\imageformats or make an installer

    Qt Code:
    1. #include <QApplication>
    2. #include "MyBrowser.h"
    3.  
    4. int main(int argc, char* argv[])
    5. {
    6. QApplication app(argc, argv);
    7.  
    8. CMyBrowser* myBrowser = new CMyBrowser();
    9. myBrowser->show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to patrik08 for this useful post:

    rexi (10th December 2008)

  4. #3

    Default Re: WekKit won't load JPEG images.

    Hi

    Thanks for your advice. But it still doesn't work. I have even re-installed Qt 4.4.3 on my dev system and used "browser.exe" sample along with the needed Qt dlls and the plugins in the "imageformats" sub-directory. It still doesn't work on certain systems and I don't know why. Same thing, certain images are not showing.

    Please help

    Thanks
    Andre

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: WekKit won't load JPEG images.

    Where exactly did you put the image plugins in the target system?

  6. #5
    Join Date
    Nov 2008
    Posts
    142
    Thanks
    3
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: WekKit won't load JPEG images.

    Quote Originally Posted by patrik08 View Post
    you must only copy path
    %QTDIR%\plugins\imageformats to applicationpath\imageformats or make an installer
    Great, I just had the same problem when I came across this post

    @andrem: Are you putting the plugin DLLs in the right place? The DLLs have to be in a folder named "imageformats" directly below the folder your application executable is in. This way it works for me, my application is finally displaying images in WebKit.

    Or maybe it's a problem with the release/debug versions of the DLLs, did you copy the right ones?

Similar Threads

  1. Problem with displaying jpeg and gif images, in QT4
    By node_ex in forum Installation and Deployment
    Replies: 1
    Last Post: 23rd September 2008, 15:29
  2. JPEG Images not shown in QiconView using QT3??
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2006, 20:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.