| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 3 | |
I am having some intermittent problems with a Splashscreen (code at end
of this message) using Qt 4.2.3. I load a QPixmap from a file, then pass
this to the constructor of the Splashscreen. This works fine on two of
my machines, but on few others. Mine are running Windows XP, latest
updates, other machines running either Windows 2K and XP. In the code
below, I include a debugging loop. Does anyone have any clues as to why
this works on some machines but not on others? On the machines were it
does NOT work, the debugging code reports image size of 0, but that the
file exists. So apparently, the system is having trouble loading the
image from the file. The image is veiwable by other programs, e.g.
browsers or Adobe, etc.
QPixmap pix ("../images/BIPSSPLASH.jpg","JPG");
QSplashScreen *splash=0;
if (pix.width()>10)
splash = new QSplashScreen( pix);
if (splash)
splash->show();
else // debugging code: why does this not display on some machines??
{
QFile spl;
spl.setFileName("../images/BIPSSPLASH.jpg");
QString msg="Error creating splash screen";
msg+="\nSize of image loaded is w=";
msg+=QString::number(pix.width());
msg+=" h=";
msg+=QString::number(pix.height());
if (spl.exists())
{
msg+="\nFile exists!!";
}
else
msg+="\nFile not found";
QMessageBox::critical(0, "Error Initializing BIPSMain",
msg,
QMessageBox::Ok, QMessageBox::NoButton);
// return -1;
}
--
[ signature omitted ]
This may be a stupid question, but did you try a newer version of Qt?
It may be some kind of Qt 4.2.3 bug, may be problems with JPEG plug-in (or
lack of it on those systems) or whatever... I haven't found anything wrong
in your code.
And a suggestion: consider using
QString msg("Error creating splash screen\n"
"Size of image loaded is w=%1 h=%2\n"
"File %3")
.arg(pix.width())
.arg(pix.height)
.arg(spl.exists() ? "exists!!" : "not found");
instead of those "msg+=...".
On Sun, 16 Mar 2008 07:23:21 +0300, Kenneth Beck <nekkceb@xxxxxxxxxxx>
wrote:
> I am having some intermittent problems with a Splashscreen (code at end
> of this message) using Qt 4.2.3. I load a QPixmap from a file, then pass
> this to the constructor of the Splashscreen. This works fine on two of
> my machines, but on few others. Mine are running Windows XP, latest
> updates, other machines running either Windows 2K and XP. In the code
> below, I include a debugging loop. Does anyone have any clues as to why
> this works on some machines but not on others? On the machines were it
> does NOT work, the debugging code reports image size of 0, but that the
> file exists. So apparently, the system is having trouble loading the
> image from the file. The image is veiwable by other programs, e.g.
> browsers or Adobe, etc.
>
> QPixmap pix ("../images/BIPSSPLASH.jpg","JPG");
> QSplashScreen *splash=0;
> if (pix.width()>10)
> splash = new QSplashScreen( pix);
> if (splash)
> splash->show();
> else // debugging code: why does this not display on some machines??
> {
> QFile spl;
> spl.setFileName("../images/BIPSSPLASH.jpg");
> QString msg="Error creating splash screen";
> msg+="\nSize of image loaded is w=";
> msg+=QString::number(pix.width());
> msg+=" h=";
> msg+=QString::number(pix.height());
> if (spl.exists())
> {
> msg+="\nFile exists!!";
> }
> else
> msg+="\nFile not found";
> QMessageBox::critical(0, "Error Initializing BIPSMain",
> msg,
> QMessageBox::Ok, QMessageBox::NoButton);
> // return -1;
> }
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]
Thanks for response. I was not aware of JPEG plugins, maybe that is the
problem. Not sure how to check for that, however, is that something that
would come with Qt?? Am I missing a .dll to send to the users?
Thanks for the code suggestion, I have used the .arg() trick in the
past, just not in this code chunk.
Constantin Makshin wrote:
> This may be a stupid question, but did you try a newer version of Qt?
> It may be some kind of Qt 4.2.3 bug, may be problems with JPEG plug-in
> (or lack of it on those systems) or whatever... I haven't found anything
> wrong in your code.
>
> And a suggestion: consider using
> QString msg("Error creating splash screen\n"
> "Size of image loaded is w=%1 h=%2\n"
> "File %3")
> .arg(pix.width())
> .arg(pix.height)
> .arg(spl.exists() ? "exists!!" : "not found");
> instead of those "msg+=...".
>
--
[ signature omitted ]
Hi, > I am having some intermittent problems with a Splashscreen (code at end > of this message) using Qt 4.2.3. I load a QPixmap from a file, then pass > this to the constructor of the Splashscreen. This works fine on two of > my machines, but on few others. Mine are running Windows XP, latest > updates, other machines running either Windows 2K and XP. In the code > below, I include a debugging loop. Does anyone have any clues as to why > this works on some machines but not on others? On the machines were it > does NOT work, the debugging code reports image size of 0, but that the > file exists. So apparently, the system is having trouble loading the > image from the file. The image is veiwable by other programs, e.g. > browsers or Adobe, etc. Have you built JPEG capability into Qt? By default JPEG support is built into a Qt plugin. Make sure the JPEG plugin is deployed with your application. http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins -- [ signature omitted ]
Thanks for the tip, I used the walker, but I do not see JPEG or JPG listed anywhere. Also, I remember options like this used to be required when installing Qt3, but I do not recall an option list for Qt4. How do I turn that on, and this still begs the question why it works on my machine, but not for other users. If I had that turned off, you would think it would not work on my machine either. I get no other error messages other than the fact that the jpg file is not loaded for the splash screen. All other features work, and this is a pretty substantial application at this point. Dimitri wrote: > Hi, > >> I am having some intermittent problems with a Splashscreen (code at >> end of this message) using Qt 4.2.3. I load a QPixmap from a file, >> then pass this to the constructor of the Splashscreen. This works fine >> on two of my machines, but on few others. Mine are running Windows XP, >> latest updates, other machines running either Windows 2K and XP. In >> the code below, I include a debugging loop. Does anyone have any clues >> as to why this works on some machines but not on others? On the >> machines were it does NOT work, the debugging code reports image size >> of 0, but that the file exists. So apparently, the system is having >> trouble loading the image from the file. The image is veiwable by >> other programs, e.g. browsers or Adobe, etc. > > Have you built JPEG capability into Qt? By default JPEG support is built > into a Qt plugin. Make sure the JPEG plugin is deployed with your > application. > http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins > > -- > Dimitri -- [ signature omitted ]
Hi, > Thanks for the tip, I used the walker, but I do not see JPEG or JPG > listed anywhere. Also, I remember options like this used to be required > when installing Qt3, but I do not recall an option list for Qt4. How do > I turn that on, and this still begs the question why it works on my > machine, but not for other users. If I had that turned off, you would > think it would not work on my machine either. I get no other error > messages other than the fact that the jpg file is not loaded for the > splash screen. All other features work, and this is a pretty substantial > application at this point. Most probably, it works on your machine because plugins were installed on this machine when building Qt. You need to deploy these plugins on target machines, together with Qt: http://doc.trolltech.com/4.3/plugins-howto.html http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins -- [ signature omitted ]
Dimitri, this sounds like it may be it. I guess I have not read complete documentation! Will try this to see if it works. Dimitri wrote: > Hi, > >> Thanks for the tip, I used the walker, but I do not see JPEG or JPG >> listed anywhere. Also, I remember options like this used to be >> required when installing Qt3, but I do not recall an option list for >> Qt4. How do I turn that on, and this still begs the question why it >> works on my machine, but not for other users. If I had that turned >> off, you would think it would not work on my machine either. I get no >> other error messages other than the fact that the jpg file is not >> loaded for the splash screen. All other features work, and this is a >> pretty substantial application at this point. > > Most probably, it works on your machine because plugins were installed > on this machine when building Qt. You need to deploy these plugins on > target machines, together with Qt: > http://doc.trolltech.com/4.3/plugins-howto.html > http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins > > -- > Dimitri -- [ signature omitted ]
Still having trouble. I found the qjpeg1.dll (qjpegd1.dll also) and placed them in the plugins folder under where the main .exe file is intalled, and I created a qt.conf file with the entry: [Paths] Plugins = plugins I tried all sorts of combinations to get this to work. I created a "plugins" folder under the folder where the .exe file is and put the qjpeg.dll in there, I changed Plugins=plugins to Plugins=./plugins, .\plugins, /plugins, \plugins (all in desperation.....). I also tried putting the .dll in with the .exe file, with appropriate changes to the .conf file. Now I am following the directions for statically linking. I put the QTPLUGIN += qjpeg in my .pro file, and in the Main.cpp, I put #include <QtPlugin> along with the macro Q_IMPORT_PLUGIN(qjpeg) (also tried qjpeg1, since that is the name of the .dll) I did a full re-build of the application after loading the new .pro file and now I get the linker error: BIPSMain.obj : error LNK2019: unresolved external symbol "class QObject * __cdecl qt_plugin_instance_qjpeg1(void)" (?qt_plugin_instance_qjpeg1@@YAPAVQObject@@XZ) referenced in function "public: __thiscall Staticqjpeg1PluginInstance::Staticqjpeg1PluginInstance(void)" (??0Staticqjpeg1PluginInstance@@QAE@XZ) Using Microsoft VC++ 2003 (ver 7.1), visual studio integration v 1.2.1 and Qt 4.2.3. any clues now??? Kenneth Beck wrote: > Dimitri, this sounds like it may be it. I guess I have not read complete > documentation! Will try this to see if it works. > > Dimitri wrote: >> >> Most probably, it works on your machine because plugins were installed >> on this machine when building Qt. You need to deploy these plugins on >> target machines, together with Qt: >> http://doc.trolltech.com/4.3/plugins-howto.html >> http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins >> >> -- >> Dimitri -- [ signature omitted ]
1) Qt4 plug-ins have "4" as the name suffix (qjpeg4.dll, qsvg4.dll, etc.) 2) AFAIK, static version of Qt doesn't support dynamic plug-ins. So you should search for either qjpeg.lib or qjpeg4.lib (I don't know how static plug-ins are named) or build it from sources by yourself. Dynamic version of Qt should find your plug-ins automatically if they're placed in correct directory (look at the documentation for details). On Friday 21 March 2008, Kenneth Beck wrote: > Still having trouble. I found the qjpeg1.dll (qjpegd1.dll also) and > placed them in the plugins folder under where the main .exe file is > intalled, and I created a qt.conf file with the entry: > [Paths] > Plugins = plugins > > I tried all sorts of combinations to get this to work. I created a > "plugins" folder under the folder where the .exe file is and put the > qjpeg.dll in there, I changed Plugins=plugins to Plugins=./plugins, > ..\plugins, /plugins, \plugins (all in desperation.....). I also tried > putting the .dll in with the .exe file, with appropriate changes to the > ..conf file. > > Now I am following the directions for statically linking. I put the > QTPLUGIN += qjpeg > in my .pro file, > and in the Main.cpp, I put > #include <QtPlugin> > along with the macro > Q_IMPORT_PLUGIN(qjpeg) (also tried qjpeg1, since that is the name of the > ..dll) > > I did a full re-build of the application after loading the new .pro file > and now I get the linker error: > BIPSMain.obj : error LNK2019: unresolved external symbol "class QObject > * __cdecl qt_plugin_instance_qjpeg1(void)" > (?qt_plugin_instance_qjpeg1@@YAPAVQObject@@XZ) referenced in function > "public: __thiscall > Staticqjpeg1PluginInstance::Staticqjpeg1PluginInstance(void)" > (??0Staticqjpeg1PluginInstance@@QAE@XZ) > > Using Microsoft VC++ 2003 (ver 7.1), visual studio integration v 1.2.1 > and Qt 4.2.3. > > any clues now??? > > Kenneth Beck wrote: > > Dimitri, this sounds like it may be it. I guess I have not read complete > > documentation! Will try this to see if it works. > > > > Dimitri wrote: > >> Most probably, it works on your machine because plugins were installed > >> on this machine when building Qt. You need to deploy these plugins on > >> target machines, together with Qt: > >> http://doc.trolltech.com/4.3/plugins-howto.html > >> http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins > >> > >> -- > >> Dimitri > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > "unsubscribe" in the subject or the body. List archive and information: > http://lists.trolltech.com/qt-interest/ -- [ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
Constantin, thanks for the response. I do not find any file name
qjpeg4.dll. All the files in my plugin folder under Qt/4.2.3 have a "1",
not a "4" at the end of the name (that includes files in other folders,
the ones I am using are in 'imageformats'). I do not have a Qt version 1
installation on my computer, I do have a Qt3, which was built from
source, and again, there are no files with '3' in them in the plugins
folder!
Also, when I open any of these files use the dependency.exe program, I
see they depend on Qt4 stuff. My installation is from the binaries, it
was not a build. Do I need to build the Qt system to get these files?
I realize static and dynamic are not the same, these are two separate
efforts to get something to work.
I just tried adding the .lib files to my build, by adding a section to
my .pro file:
win32:
{
LIBS += c:/pgms/mcc/cwin/cbw32.lib
debug:
{
LIBS += $(QTDIR)/plugins/imageformats/qjpegd1.lib
}
release:
{
LIBS += $(QTDIR)/plugins/imageformats/qjpeg1.lib
}
}
Note that I followed the template given in the qmake tutorial, which
gives the following example:
win32 {
debug {
CONFIG += console
}
}
In my case, I got qmake errors unless I added the ':' after win32: and
after debug: release: Just pointing out a possible documentation issue.
Again, I use the '1' because there are no '4' files there.
I still get the linker error. I have tried the following combinations in
my main.cpp, all give linker errors.
Q_IMPORT_PLUGIN(qjpeg)
Q_IMPORT_PLUGIN(qjpeg1)
Q_IMPORT_PLUGIN(qjpegd1)
I should not have to struggle this hard! I view this as a documentation
issue.
Thanks for your help, it would be good to get this working, either
statically or dynamically, I guess my next step may be to re-build from
source, but why should I have to do that?? Also, based on the naming for
Qt3, I would not expect the '...4.dll' to appear!
Ken
Constantin Makshin wrote:
> 1) Qt4 plug-ins have "4" as the name suffix (qjpeg4.dll, qsvg4.dll, etc.)
>
> 2) AFAIK, static version of Qt doesn't support dynamic plug-ins. So you should
> search for either qjpeg.lib or qjpeg4.lib (I don't know how static plug-ins
> are named) or build it from sources by yourself.
> Dynamic version of Qt should find your plug-ins automatically if they're
> placed in correct directory (look at the documentation for details).
--
[ signature omitted ]
Hi, > I should not have to struggle this hard! I view this as a documentation > issue. I think all the necessary information is already in the documentation: http://doc.trolltech.com/4.3/plugins-howto.html There are several plugin base classes. Derived plugins are stored by default in sub-directories of the standard plugin directory. Qt will not find plugins if they are not stored in the right directory. [...] QImageIOPlugin imageformats Case Sensitive [...] But where is the plugins 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. -- [ signature omitted ]
OK, I must have missed that table. I will give this a try. So, what did my static linking effort not work? Ihad the full path to the .lib correct there. Was there some other file I was missing? Also, see my note about the win32:LIBS setting in the .pro file: when I cut/paste from the documentation into my pro file, I get qmake errors, you have to add ':' to make it work. Ken Dimitri wrote: > > I think all the necessary information is already in the documentation: > http://doc.trolltech.com/4.3/plugins-howto.html > > There are several plugin base classes. Derived plugins are stored > by default in sub-directories of the standard plugin directory. > Qt will not find plugins if they are not stored in the right > directory. > [...] > QImageIOPlugin imageformats Case Sensitive > [...] > But where is the plugins 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. -- [ signature omitted ]
Hi,
> OK, I must have missed that table. I will give this a try. So, what did
> my static linking effort not work? Ihad the full path to the .lib
> correct there. Was there some other file I was missing?
Static linking implies static libraries. Do you have static Qt libraries and
plugins to link with in the first place?
> Also, see my note about the win32:LIBS setting in the .pro file: when I
> cut/paste from the documentation into my pro file, I get qmake errors,
> you have to add ':' to make it work.
It works in Qt itself, for example in tools/assistant/assistant.pro:
win32 {
LIBS += -lshell32
RC_FILE = assistant.rc
}
mac {
ICON = assistant.icns
I'm not sure why it didn't work in your case. Which of the following did you
try? This:
win32 {
...
or that:
win32
{
...
--
[ signature omitted ]
I tried most of your combinations, I had to have the ':' or I get qmake
errors.
Come to think of it, I may not have all the static link libraries
available, silly me, I did pick dynamic linking on install.
BTW, my splashscreen is now working using the dynamic linking, thanks
for all your help, and sorry I did not do a complete job of reading
documentation!
Ken Beck
Dimitri wrote:
> Hi,
>
>
> It works in Qt itself, for example in tools/assistant/assistant.pro:
> win32 {
> LIBS += -lshell32
> RC_FILE = assistant.rc
> }
>
> mac {
> ICON = assistant.icns
>
> I'm not sure why it didn't work in your case. Which of the following did
> you try? This:
> win32 {
> ...
> or that:
> win32
> {
> ...
>
> --
> Dimitri
--
[ signature omitted ]
Hi, > BTW, my splashscreen is now working using the dynamic linking, thanks > for all your help, and sorry I did not do a complete job of reading > documentation! Oh, I didn't mean to tell you hadn't done your homework. The documentation is large and I don't thinkg anyone on this mailing list expects you to have read all of it (not to mention remembering it). Thinking of it again, I think this page: http://doc.trolltech.com/4.3/deployment-windows.html#qt-plugins should include a link to that page: http://doc.trolltech.com/4.3/plugins-howto.html -- [ signature omitted ]