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. [SOLVED] Help on QSplitter
QtWS25 Last Chance

[SOLVED] Help on QSplitter

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 8.7k 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.
  • M Offline
    M Offline
    M_31
    wrote on last edited by
    #1

    Hi…
    I am facing some problem QSplitter stylesheet
    I have set the stylesheet of my QSplitter as

    @
    parentsplitter->setStyleSheet("QSplitter { border-color: rgb(255, 0, 0); color: rgb(145, 145, 145); height: 5px;background-color: rgb(225,230,234); }");
    @
    But i can see only the background color of my QSplitter is getting changed, but i want to change my border color of QSplitter from my main window..

    Please help me on this..
    .

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

      I don't understand what you want exactly. Can you post a picture of what you want?
      And it's much easier to follow if you use colors like red, blue , yellow, green..You can change it back afterwards.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • M Offline
        M Offline
        M_31
        wrote on last edited by
        #3

        Please refer the below picture , which is my window having 3 childsplitter's which is again embedded into the parent splitter... Now i want to change the border color on each childsplitter..so i have used

        @
        parentsplitter->setStyleSheet("QSplitter { border-color: black; color: red; height: 5px;background-color: green; }");
        childViewSplitter->setStyleSheet("QSplitter { border-color: black; color: red; height: 5px;background-color: green; }");
        childsplitter1->setStyleSheet("QSplitter { border-color: black; color: red; height: 5px;background-color: green; }");
        childsplitter2->setStyleSheet("QSplitter { border-color: black; color: red; height: 5px;background-color: green; }");@

        @


        | | |
        | child | |
        | viewSplit | |
        | | child |
        || splitter2 |
        | | |
        | childSplit1 | |
        | | |
        |
        |______________________________|
        @

        Here i can see only the background color is getting changed into green, nothing else...
        But i want to change my border color of my childsplitter's

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

          I think the reason is that you don't have a border width set. So it's obvious you don't see it.

          The default frameshape in Qt Designer is NoFrame. You should change it to Box and the LineWidth to 10 for instance then you will see your colors.

          One question : between Child viewsplit and childsplit1 is that your handle? I ask because the handle gets it's color separetely.

          Using the following stylesheet I set the colors for the frame border in blue and the handle in black :

          @QSplitter {
          color: blue;
          }

          QSplitter::handle {background-color: black;}@

          EDIT : I like to play in Qt Designer with stylesheets instead of using code immediately.
          Once my results are satisfying, then I copy the stylesheet in code.

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M_31
            wrote on last edited by
            #5

            I haven't used any handler in my code and also i haven't used any QFrame to set my Parentsplitter..

            Also i set the linewidth of my QSplitter to 10

            @
            parentsplitter->setLineWidth(10);
            childViewSplitter->setLineWidth(10);
            childsplitter1->setLineWidth(10);
            childsplitter2->setLineWidth(10);
            @

            But i am not seeing any difference to my window.

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

              if you use QSplitter, you have a handle and you should consider it.
              QSplitter acts like QFrame when using stylesheets.

              try this code copied from my ui_test.h file (it works for me):

              @splitter->setFrameShape(QFrame::Box);
              splitter->setLineWidth(10);
              splitter->setHandleWidth(10);@

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • M Offline
                M Offline
                M_31
                wrote on last edited by
                #7

                Thank you ..now my issue is solved..
                After making necessary changes on Splitter to setFrame(Qframe::box)..

                Thank you for your valuable inputs...

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

                  You're welcome.

                  Have fun Qt programming!

                  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