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. image's parent is being passed to child widget..

image's parent is being passed to child widget..

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 344 Views 1 Watching
  • 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.
  • 1 Offline
    1 Offline
    1XU7
    wrote on last edited by
    #1

    Hello!.. image is self-explanable..

    What could it be?

    Thanks

    00.png

    1 Reply Last reply
    0
    • 1 1XU7

      Auto-answering... i found the correct way, i post here the solution for people who need to fix this as me...

      just needed to set stylesheet in QFrame parent only.. for all childs too..

      In QFrame:

      QFrame {
          border-image: url(:/imgs/resources/imgBanner.png);
      }
      
      QPushButton {
          background-color: rgb(85, 255, 255);	
          color: rgb(0, 0, 0);
      }
      

      thanks anyway!

      Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #3

      @1XU7 CSS stands for Cascading Style Sheets, meaning when you set a property on an instance it cascades down the children tree.

      Your solution works, but is kinda intrusive. You shouldn't change buttons style to set a QFrame style. A better solution would be to give the frame object a name using setObjectName() or via property editor in designer and then only set the style for that:

      #MyFrame {
         border-image: url(:/imgs/resources/imgBanner.png);
      }
      
      1 1 Reply Last reply
      4
      • 1 Offline
        1 Offline
        1XU7
        wrote on last edited by
        #2

        Auto-answering... i found the correct way, i post here the solution for people who need to fix this as me...

        just needed to set stylesheet in QFrame parent only.. for all childs too..

        In QFrame:

        QFrame {
            border-image: url(:/imgs/resources/imgBanner.png);
        }
        
        QPushButton {
            background-color: rgb(85, 255, 255);	
            color: rgb(0, 0, 0);
        }
        

        thanks anyway!

        Chris KawaC 1 Reply Last reply
        0
        • 1 1XU7

          Auto-answering... i found the correct way, i post here the solution for people who need to fix this as me...

          just needed to set stylesheet in QFrame parent only.. for all childs too..

          In QFrame:

          QFrame {
              border-image: url(:/imgs/resources/imgBanner.png);
          }
          
          QPushButton {
              background-color: rgb(85, 255, 255);	
              color: rgb(0, 0, 0);
          }
          

          thanks anyway!

          Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #3

          @1XU7 CSS stands for Cascading Style Sheets, meaning when you set a property on an instance it cascades down the children tree.

          Your solution works, but is kinda intrusive. You shouldn't change buttons style to set a QFrame style. A better solution would be to give the frame object a name using setObjectName() or via property editor in designer and then only set the style for that:

          #MyFrame {
             border-image: url(:/imgs/resources/imgBanner.png);
          }
          
          1 1 Reply Last reply
          4
          • 1 1XU7 has marked this topic as solved on
          • Chris KawaC Chris Kawa

            @1XU7 CSS stands for Cascading Style Sheets, meaning when you set a property on an instance it cascades down the children tree.

            Your solution works, but is kinda intrusive. You shouldn't change buttons style to set a QFrame style. A better solution would be to give the frame object a name using setObjectName() or via property editor in designer and then only set the style for that:

            #MyFrame {
               border-image: url(:/imgs/resources/imgBanner.png);
            }
            
            1 Offline
            1 Offline
            1XU7
            wrote on last edited by 1XU7
            #4

            @Chris-Kawa thanks, that is even more elegant!!

            Just was wondering my solution is bad, because, what happens if i had more than one QFrame?.. or more than one button?.. the style will be changed for all of them...
            but identifying as you said then that problem will gone..

            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