Set QSplitter as a line with width = 1px ?



  • My window is compsoed of two QSplitter widgets, a horizontal one and a vertical one. Currently I put a grey line on the handle. I found there are still a grey border around the splitter, instead of the single line in the middle. How can I set the splitter with width=1 px?

    part of my code is:

    QSplitterHandle * vHandle = mHSplitter->handle(1);
    QHBoxLayout * vLayout = new QHBoxLayout(vHandle);
    vLayout->setSpacing(0);
    vLayout->setMargin(0);
    QFrame * vLine = new QFrame(vHandle);
    vLine->setFrameShape(QFrame::VLine);
    vLine->setStyleSheet("color:rgb(157,157,157)");
    vLayout->addWidget(vLine);
    

    The screenshot is here:
    Screenshot


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Why not create your own subclass of QSplitterHandle that renders the way you want it ?


Log in to reply
 

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