Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt background-image shows in designer but not in release
QtWS25 Last Chance

Qt background-image shows in designer but not in release

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cenarius2
    wrote on 15 Jul 2013, 16:55 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vittalonline
      wrote on 16 Jul 2013, 11:00 last edited by
      #2

      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.

      1 Reply Last reply
      0

      1/2

      15 Jul 2013, 16:55

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved