Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, April 2007
RE: .png image display problem on ARM


Message 1 in thread

> Hi all,
> 
> I have created a GUI application for OMAP5912 on Linux.It is working 
> fine,besides one problem. The problem is that a " .png image is not 
> disalaying on the screen". I have checked the code, but found nothing 
> wrong.The .png image is also in the directory. When i am running the 
> application on Virtual frame buffer, the image is displaying 
> perfectly,but not on the OMAP5912 hardware. Any help or 
> suggestion will 
> be appriciated.
> Thank you.
> 
> 
> regards,
> Sandeep
> 

Sandeep,

I had a problem like this, although I didn't try the Virtual Frame
Buffer.

It turned out that the linker was optimizing away the
qmake_image_collection.cpp code.

I got things to work by calling the function that should be implicitly
called by a constructor:

// The following declaration is necessary to force the linker
// to include the qmake_image_collection.cpp code, which is
// "optimized" away otherwise.
void qInitImages_projectname();

And in the initialization code:

	// force initialization of static images
	qInitImages_projectname();

Where "projectname" is the name of your project.

This is a function in the code generated by the moc compiler to manage
the embedded images.


Ralph Walden

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 2 in thread

The changes I'm referring to are not in Qt, but in your application.

If you add the code I describe into your main.cpp, that would be fine.

When you build your project, you have some project file called:

myproject.pro

Qmake creates a Makefile which builds your project, executing moc for
your ui files, etc.
Embedding images in your GUI design using Qt Designer causes this
process to create a .cpp file which contains the images.  This is
probably the file "qmake_image_collection.cpp" most likely located in a
".ui" subdirectory in your project directory.

This qmake_image_collection.cpp code depends on a constructor of a
object which is statically declarared to call an initialization function
"qInitImages_projectname()" in the same file.

Well, since the cross-linker sees no explicit reference to this function
(or any qmake_image_collection.cpp code) it assumes that it is dead code
and so "optimizes" it away.

That's why (I think) I had to add an explicit call to this function
(qInitImages_projectname()) in MY code.  I added a call to this function
in my "main()" function.

Is anyone else familiar with this problem?  Trolltech guys?


Ralph Walden 

> -----Original Message-----
> From: sandeep bihal [mailto:sandeepbihal@xxxxxxxxx] 
> Sent: Wednesday, April 04, 2007 12:58 AM
> To: Ralph Walden
> Subject: Re: .png image display problem on ARM
> 
> Ralph Walden wrote:
> 
> >>Hi all,
> >>
> >>I have created a GUI application for OMAP5912 on Linux.It 
> is working 
> >>fine,besides one problem. The problem is that a " .png image is not 
> >>disalaying on the screen". I have checked the code, but 
> found nothing 
> >>wrong.The .png image is also in the directory. When i am 
> running the 
> >>application on Virtual frame buffer, the image is displaying 
> >>perfectly,but not on the OMAP5912 hardware. Any help or 
> >>suggestion will 
> >>be appriciated.
> >>Thank you.
> >>
> >>
> >>regards,
> >>Sandeep
> >>
> >>    
> >>
> >
> >Sandeep,
> >
> >I had a problem like this, although I didn't try the Virtual Frame
> >Buffer.
> >
> >It turned out that the linker was optimizing away the
> >qmake_image_collection.cpp code.
> >
> >I got things to work by calling the function that should be 
> implicitly
> >called by a constructor:
> >
> >// The following declaration is necessary to force the linker
> >// to include the qmake_image_collection.cpp code, which is
> >// "optimized" away otherwise.
> >void qInitImages_projectname();
> >
> >And in the initialization code:
> >
> >	// force initialization of static images
> >	qInitImages_projectname();
> >
> >Where "projectname" is the name of your project.
> >
> >This is a function in the code generated by the moc compiler 
> to manage
> >the embedded images.
> >
> >
> >Ralph Walden
> >
> >  
> >
> Ralph,
> i did not understand,where to make changes.(in which files). 
> Can you be 
> more specific..?
> 
> regards,
> Sandeep
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 
> 

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx