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. Qss in widget

Qss in widget

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 6.6k 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.
  • R Offline
    R Offline
    Ruzik
    wrote on last edited by
    #1

    Hellow!
    I have widget and widget set color, for example red, and when this widget include in other widget, for example window, there is no color, but if widget is separate window that all right
    I use following qss code
    @ RSeveralElements
    {
    border: 1 solid rgb(136, 136, 136);
    border-radius: 6px;
    min-height: 20px;
    min-width: 40px;
    background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
    stop: 0 #cccccc, stop: 1 #eeeeee);
    }@
    RSeveralElements heir of QWidget
    Advance many thanks for your help!

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Have a look at "this thread.":http://developer.qt.nokia.com/forums/viewthread/7470/

      I think your situation is similar.

      In what widget to you include RSeveralElements?

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Ruzik
        wrote on last edited by
        #3

        I include it in main layout(QVBoxLayout) in QMainWindow

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Ruzik
          wrote on last edited by
          #4

          Many thanks for your help, it is work!

          1 Reply Last reply
          0
          • EddyE Offline
            EddyE Offline
            Eddy
            wrote on last edited by
            #5

            I'm glad for you.

            Please add [Solved] in front of your title

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Ruzik
              wrote on last edited by
              #6

              I was a little hasty with the findings, it work, but it work wrong
              This is full qss code after fixed
              @ RSeveralElements, RSeveralElements *
              {
              border: 1 solid rgb(136, 136, 136);
              border-radius: 6px;
              min-height: 20px;
              min-width: 40px;
              background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
              stop: 0 #cccccc, stop: 1 #eeeeee);
              }
              RSeveralWidget, RSeveralWidget *{
              background-color: transparent;
              }
              RSeveralWidget:hover, RSeveralWidget *:hover{
              border: 1 solid #55aaff;
              }@
              RSeveralElements(parent: QWidget) is widget-panel, where situate QSeveralWidget(parent: QToolButton)
              After that create border in RSeveralWidget, but if i remove this
              @RSeveralWidget:hover, RSeveralWidget *:hover{
              border: 1 solid #55aaff;
              }@
              There are no to create
              But i need to create border in RSeveralElements

              1 Reply Last reply
              0
              • EddyE Offline
                EddyE Offline
                Eddy
                wrote on last edited by
                #7

                if I understand you well, your initial problem is solved.

                Additionally you want a border when hovering over RSeveralWidget. The qss works here. ( it works in my case, I get a blue border when I hover it.)
                But for RSeveralElements you don't get a border when you hover over it? I don't see the hover part for that one in your example.

                You could add RSeveralElements:hover too.

                Qt Certified Specialist
                www.edalsolutions.be

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  Ruzik
                  wrote on last edited by
                  #8

                  I wish that would border RSeveralElements cover all elements onto RSeveralWidgets
                  http://hostingkartinok.com/show-image.php?id=29b3ce1c5f18b9ce6fd0329626aad3a8

                  1 Reply Last reply
                  0
                  • EddyE Offline
                    EddyE Offline
                    Eddy
                    wrote on last edited by
                    #9

                    I see, one picture tells more than 1000 words ;)

                    You can put RSeveralWidgets in a QFrame and let that one highlight.

                    Qt Certified Specialist
                    www.edalsolutions.be

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      Ruzik
                      wrote on last edited by
                      #10

                      Many thanks, it is work as could!
                      Tell me, please, why is this happening?

                      1 Reply Last reply
                      0
                      • EddyE Offline
                        EddyE Offline
                        Eddy
                        wrote on last edited by
                        #11

                        I don't understand what you are saying.

                        Qt Certified Specialist
                        www.edalsolutions.be

                        1 Reply Last reply
                        0
                        • R Offline
                          R Offline
                          Ruzik
                          wrote on last edited by
                          #12

                          Sorry for my bad english
                          I want to ask: Why is the variant with QWidget dont work, and why is it work with QFrame?

                          1 Reply Last reply
                          0
                          • EddyE Offline
                            EddyE Offline
                            Eddy
                            wrote on last edited by
                            #13

                            Because you want 2 widgets highlight as one.

                            Normally 2widgets will highlight as 2 different rectangles.

                            If you want 1 highlighted rectangle you have to use 1widget. Putting the widgets in a QFrame does the trick.

                            I hope you understand it now.

                            Qt Certified Specialist
                            www.edalsolutions.be

                            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