PDA

View Full Version : Demo Browser cannot display jpeg or gif



stmk
22nd October 2010, 14:13
i use the demo browser which is provided by qt
it can go to the website, but it cannot display the jpeg and gif file.

can anyone help me?
Thanks!

Lykurg
22nd October 2010, 14:14
Make sure you provide the needed image plugins for displaying jpeg and gif.

stmk
22nd October 2010, 14:21
thanks for your reply.

but i dont know which image plugins that i need.
i just use the demo browser, but havent change any codes.

Lykurg
22nd October 2010, 14:32
but i dont know which image plugins that i need.The jpeg and the gif plugin and any other image format you want to be displayed.
i just use the demo browser, but havent change any codes.Yeah, but you must make sure Qt finds the plugins locationed under imageformats. If you run the browser from the Qt Comand Line, did you see the images? If you distribute the app, you have to deliver the plugins alongside your app. See http://doc.trolltech.com/4.7/deployment-windows.html

stmk
22nd October 2010, 14:52
actually, the demo browser can display the jpeg and gif in my computer (which is installed qt and the vs2008)

however, when i put the browser.exe (rebuild the program wihtout changing any codes) in another computers (which does not installed qt and vs2008),
it can still go to the website, but cannot display jpeg or gif

Lykurg
22nd October 2010, 15:01
however, when i put the browser.exe (rebuild the program wihtout changing any codes) in another computers (which does not installed qt and vs2008),
it can still go to the website, but cannot display jpeg or gifAnd that's why I post you the link. You have to deliver the plugins alongside your exe as it is described at the end of the linked page.

stmk
23rd October 2010, 13:05
thanks so much!

I put the following code in the main function

QCoreApplication::addLibraryPath(QCoreApplication: :applicationDirPath()+"/imageformats");

then it works now!

wysota
23rd October 2010, 13:22
Do you have an "imageformats" subdirectory inside your "imageformats" directory?

stmk
23rd October 2010, 13:32
no

actually, i put the "imageformats" folder in the release folder (browser.exe also inside in release folder)
\browser\release\imageformats

when i click browser.exe, it can show the jpeg and gif

wysota
23rd October 2010, 13:33
Then remove the addLibraryPath() call because it doesn't do anything. It would work if you had an imageformats subdirectory in imageformats directory.

stmk
23rd October 2010, 17:56
i see..
thanks so much anyway!