×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Embedded Qt Resources

    I have a Qt application that makes use of a couple of embedded png images. Nothing excessive.

    My N900 is upgraded to PR1.1 and my SDK has been upgraded to match.

    Running under the x86 scratchbox target (I use ESBox btw) is fine - the images show up.

    I recompile to ARMEL, no problem, and I can tell from the executable size that the images are embedded, yet when I run it on my N900 the images do not display.

    I get no warnings or errors at all....any ideas?

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Embedded Qt Resources

    There is not enough info. How do you use the images? How does your project look like?

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Embedded Qt Resources

    I was really asking anecdotally more than technically....but since you ask

    My .pro file has a resource entry pointing to a .qrc file. In this file are the names of two png images. qmake converts this into a .cpp file with two arrays of hexadecimal data...this gets compiled into the executable for use by my code.

    I actually declare two const QImages constructed by passing the identifiers of the two embedded images - the convention used is ":/img/image1.png"

    These two QImages are then used to paint the background of two dockable widgets.

    As I posted originally, this technique works perfectly when executing the fremantle_x86 target within xephyr....I use ESBox 2.0 to manage my SDK/Scratchbox.

    When I change target to fremantle_armel, it recompiles perfectly, I copy the executable over to my N900, it runs without warnings or errors, butg the background images are not displayed.

    Has anybody else solved a similar issue before?

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Embedded Qt Resources

    I can have only guess here that there is something wrong with a way how you set a background to dockable widgets.

  5. #5
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Embedded Qt Resources

    Again, my code works perfectly as a fremantle_x86 target. When recompiled to the fremantle_armel target, and run on my N900, the images fail to show...the app itself runs, the dockable widgets and their titles are correctly displayed, and I can move them around, but their background images are not displayed.

    Is there any knowledge of such a direct inconsistency between x86 and armel targets?

    Of course, I am continuing to hunt down other explanations, but I presume that there are people here that have embedded image resources like this, and made use of them. Has nobody encountered problems doing so?

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2009
    Posts
    430

    Re: Embedded Qt Resources

    Try Q_INIT_RESOURCE.

  7. #7
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Embedded Qt Resources

    Thanks for the suggestion

    Unfortunately, it didn't help. I believe Q_INIT_RESOURCE() is of use when you have compiled your resources into a separate binary.

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2009
    Posts
    430

    Re: Embedded Qt Resources

    It is usually neccessary of you compile the resource in a static library and then link against that library resulting in a large binary that actually contains the resources in the same binary. So it has something todo with static initializers and so on.

  9. #9
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Embedded Qt Resources

    According to the Qt 4.5 docs, what I am doing is legitimate. It works perfectly when run as the fremantle_x86 target.

    Basically, each byte in the resources is written out longhand in hexadecimal in a large array declared in a .cpp file. This is compiled as normal, just like any other code...so your resources are available as a static global. Simple solution...bloaty...but it works.

  10. #10
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Embedded Qt Resources

    I like the way how you solve problems!

    There is an example using resources file, which works on N900.
    http://www.mediafire.com/file/z2itnm...sources.tar.gz

  11. #11
    Registered User
    Join Date
    Oct 2009
    Posts
    8

    Re: Embedded Qt Resources

    Thank you Daniil, that example does work correctly

    Now I've got to figure out what I'm doing differently to cause the problem I'm experiencing.

    I will, of course, update this thread with all the embarrassing details of my stupidity when I discover them

Similar Threads

  1. Qt for Symbian development resources
    By liuxg in forum [Archived] Qt General ( Qt技术)
    Replies: 55
    Last Post: 2011-01-26, 04:06
  2. kinetic scrolling
    By stalep in forum Nokia N9
    Replies: 10
    Last Post: 2009-12-08, 12:41
  3. Senior QT Client Developer (Dublin, Ireland)
    By marynyc in forum News and Announcements
    Replies: 0
    Last Post: 2009-06-02, 18:24

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •