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. background picture won't apply to main widget
Forum Update on Monday, May 27th 2025

background picture won't apply to main widget

Scheduled Pinned Locked Moved General and Desktop
stylesheetmainwidgetbackgroundpicturewindow
4 Posts 2 Posters 1.8k 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.
  • A Offline
    A Offline
    Arty.McLabin
    wrote on 8 Jun 2015, 17:22 last edited by
    #1

    I've met a problem when applying a background picture in stylesheets at .ui designer on the main widget (window), the picture gets on every single widget besides the main (buttons, labels etc get the texture excepts the window background).

    it happens on the built and launched application, even trough the background does apply right in the .ui designer and all seems right until you launch it.

    also a background color instead of a picture works fine.

    what can cause it?
    (tried with Qt5.3 on windows7 x64, Qt 5.4 kubuntu x64, lubuntu x32)

    Static linking is cool. Really.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Arty.McLabin
      wrote on 11 Jun 2015, 05:43 last edited by
      #2

      found some kind of a passby to solve that issue.
      applying a QStackedWidget as the second widget in hierarchy, right after the main widget, makes it look just as it has to be, awful to use stacked widget in such way if you only need one "page" in your application tho.

      Static linking is cool. Really.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on 11 Jun 2015, 06:11 last edited by
        #3

        These are cascadind style sheets. This means they match not only the widget you set it on but also any children.
        If you want to match a single specific widget give it a name (setObjectName() or the corresponding field in the designer) and refer to it explicitly in the stylesheet e.g. #SomeWidget { background-image: url(...) }

        A 1 Reply Last reply 3 Jul 2015, 00:56
        0
        • C Chris Kawa
          11 Jun 2015, 06:11

          These are cascadind style sheets. This means they match not only the widget you set it on but also any children.
          If you want to match a single specific widget give it a name (setObjectName() or the corresponding field in the designer) and refer to it explicitly in the stylesheet e.g. #SomeWidget { background-image: url(...) }

          A Offline
          A Offline
          Arty.McLabin
          wrote on 3 Jul 2015, 00:56 last edited by
          #4

          @Chris-Kawa, you got me wrong i guess, the problem is not stylesheet inheritance, it's about the target widget itself NOT getting the stylesheet, instead that only passing style to children, naming him doesn't affect the result too.

          Static linking is cool. Really.

          1 Reply Last reply
          0

          • Login

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