[SOLVED] Help on QSplitter



  • 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..
    .


  • Moderators

    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.



  • 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


  • Moderators

    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.



  • 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.


  • Moderators

    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);@



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

    Thank you for your valuable inputs...


  • Moderators

    You're welcome.

    Have fun Qt programming!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.