Qt background-image shows in designer but not in release



  • I have a simple Qt GUI application and I am having trouble setting the image background. The background image displays properly in form editor/designer but when I run the application there is no background image.

    Resource file:
    @<RCC>
    <qresource prefix="/">
    <file>eb_back_small.png</file>
    <file>favicon.ico</file>
    <file>background.jpg</file>
    </qresource>
    </RCC>@

    This is how it looks like in editor:
    http://i.stack.imgur.com/v5Df7.png

    Style sheet for centralWidget (background.jpg is a simple 500x350 red image):

    @#centralWidget {
    background-image: url(:/background.jpg);
    }@

    Style sheet for widget (just to see if background-color works because I assume something is not right with my resources):

    @#widget {
    background-color: rgb(0, 170, 0);
    }@

    And this is the final result when I run the app:
    http://i.stack.imgur.com/LFxlJ.png

    What is the problem?



  • hi cenarius2

    you also maintain background.jpg file in release with app.
    bcoz, designer is only dynamic viewer of application skeleton ,
    not a app builder.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.