HBQT: gif/jpg support at runtime

59 views
Skip to first unread message

Roberto Lopez

unread,
Aug 23, 2010, 5:30:26 PM8/23/10
to harbou...@googlegroups.com
Hi All,

I've found an interesting thing.

qPixmap := QPixmap():new( "test.gif" )
oLabel:setPixmap( qPixmap )

This works fine, but only if QT is installed in the machine.

If you copy the exe and the three runtime files required
(qtgui4.dll,qtcore4.dll and mingwm10.dll) to a machine without QT
installed, you'll loose support for jpg and gif (bmp and png still working).

What is needed at runtime to get gif/jpg support without to install the
complete QT package?

It was tested on Windows 7 and XP.

Thanks in advance.


Regards,

Roberto.

Pritpal Bedi

unread,
Aug 23, 2010, 5:38:18 PM8/23/10
to Harbour Users
Hi

> I've found an interesting thing.

>         qPixmap := QPixmap():new( "test.gif" )
>         oLabel:setPixmap( qPixmap )
>
> This works fine, but only if QT is installed in the machine.
>
> If you copy the exe and the three runtime files required
> (qtgui4.dll,qtcore4.dll and mingwm10.dll) to a machine without QT
> installed, you'll loose support for jpg and gif (bmp and png still working).

Yep, this is an interesting thing, indeed.
May be some other .dll is required, just make experiments.
I could not figure-out which .dll it could be. I am suseptible
about this behavior, though.

NOTE: .png is the supported format Qt recommends which would
definitely
be working on all platforms. Also Harbour has inbuild support to embed
.png resources into the executable. So focus your directions onto this
fact.

Regards
Pritpal Bedi

Roberto Lopez

unread,
Aug 23, 2010, 5:53:54 PM8/23/10
to harbou...@googlegroups.com
Pritpal Bedi wrote:

> Yep, this is an interesting thing, indeed.
> May be some other .dll is required, just make experiments.
> I could not figure-out which .dll it could be. I am suseptible
> about this behavior, though.

I'm doing some experiments. If found something, I'll post here.

> NOTE: .png is the supported format Qt recommends which would
> definitely
> be working on all platforms. Also Harbour has inbuild support to embed
> .png resources into the executable. So focus your directions onto this
> fact.

Ok.

Thanks.

Regards,

Roberto.

Marcos Gambeta

unread,
Aug 23, 2010, 6:18:39 PM8/23/10
to harbou...@googlegroups.com
Em 23/08/2010 18:30, Roberto Lopez escreveu:
>
> What is needed at runtime to get gif/jpg support without to install the complete QT package?
>

Try this (not tested):

c:\myapp\app.exe
c:\myapp\qt.conf
c:\myapp\plugins\imageformats\qgif4.dll

qt.conf:
[Paths]
plugins=./plugins


Copy dlls from C:\Qt\2010.XX\qt\plugins\imageformats.


Regards,
Marcos Gambeta

Roberto Lopez

unread,
Aug 23, 2010, 6:25:27 PM8/23/10
to harbou...@googlegroups.com
Pritpal Bedi wrote:


> Yep, this is an interesting thing, indeed.
> May be some other .dll is required, just make experiments.
> I could not figure-out which .dll it could be. I am suseptible
> about this behavior, though.

The required dll's are located at qt/4.x.x/plugins/imageformats (you'll
loose jpg/gif support just renaming that folder).

They are qgif4.dll, qico4.dll, qjpeg4.dll, qmng4.dll, qsv4,dll and
qtiff4.dll.

The problem is that coping them to system32 or the app folder is not enough.

So, perhaps, they need a registry key to be found by a QT application at
runtime. If that is the case, is really strange... I'll keep trying...

Regards,

Roberto.

Roberto Lopez

unread,
Aug 23, 2010, 6:33:46 PM8/23/10
to harbou...@googlegroups.com
Marcos Gambeta wrote:
> Try this (not tested):
<...>

It works!!!, Thanks Marcos!!!

Regards,

Roberto.

Marcos Gambeta

unread,
Aug 23, 2010, 8:39:44 PM8/23/10
to harbou...@googlegroups.com
Em 23/08/2010 19:33, Roberto Lopez escreveu:
> It works!!!,

More info about qt.conf and plugins:

http://doc.qt.nokia.com/4.6/qt-conf.html

http://doc.qt.nokia.com/4.6/plugins-howto.html


Regards,
Marcos Gambeta

Marcos Gambeta

unread,
Aug 23, 2010, 8:52:40 PM8/23/10
to harbou...@googlegroups.com
Em 23/08/2010 19:33, Roberto Lopez escreveu:
> It works!!!

This page have more info about the plugins directory:

http://doc.qt.nokia.com/4.6/deployment-plugins.html

"The Plugin Directory
When the application is run, Qt will first treat the application's
executable directory as the pluginsbase. For example if the application
is in C:\Program Files\MyApp and has a style plugin, Qt will look in
C:\Program Files\MyApp\styles. (See
QCoreApplication::applicationDirPath() for how to find out where the
application's executable is.) Qt will also look in the directory
specified by QLibraryInfo::location(QLibraryInfo::PluginsPath), which
typically is located in QTDIR/plugins (where QTDIR is the directory
where Qt is installed). If you want Qt to look in additional places you
can add as many paths as you need with calls to
QCoreApplication::addLibraryPath(). And if you want to set your own path
or paths you can use QCoreApplication::setLibraryPaths(). You can also
use a qt.conf file to override the hard-coded paths that are compiled
into the Qt library. For more information, see the Using qt.conf
documentation. Yet another possibility is to set the QT_PLUGIN_PATH
environment variable before running the application. If set, Qt will
look for plugins in the paths (separated by the system path separator)
specified in the variable."

If I understand correctly, we can use:

c:\myapp\app.exe
c:\myapp\imageformats\qgif4.dll


Regards,
Marcos Gambeta

Roberto Lopez

unread,
Aug 23, 2010, 9:07:42 PM8/23/10
to harbou...@googlegroups.com
Marcos Gambeta wrote:
>
> If I understand correctly, we can use:
>
> c:\myapp\app.exe
> c:\myapp\imageformats\qgif4.dll

You've understood correctly.

I've tested and it works perfect.

Thanks again!

Regards,

Roberto.

Reply all
Reply to author
Forward
0 new messages