Important: Please read the Qt Code of Conduct -

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:
    <qresource prefix="/">

    This is how it looks like in editor:

    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:

    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