Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QFrame box style



  • I am under Linux, if it makes any difference to the outcome. When I create a QFrame with setFrameShape(QFrame::Box) I get a "hard, black" box frame. If I use a QGroupBox I get the box frame style/color/thickness/whatever that I would like, but don't want to use that as it has title-text space which I do not want.

    Does anyone know what I could do to a QFrame box to get similar look to that on a QGroupBox?



  • While I wait for a better answer :), I am much happier with:

    QFrame qf;
    qf.setFrameShape(QFrame::Box);
    qf.setStyleSheet("QFrame { border: 1px solid lightgray; }");
    


  • Refer to the doc of QFrame.
    It has a preview for all kinds of frame settings. Just choose what you like.
    https://doc.qt.io/qt-5/images/frames.png
    [EDITED]
    Oh, @JonB , didn't notice that you are the OP.
    I would guess you already know this.
    So the default settings can't meet your requirements?
    Then maybe you need to do that with stylesheet.



  • @Bonnie
    Yep, looked at those. And none of them looks like the frame on a QGroupBox! I'm wondering what is --- maybe it's just "grey" color on the box instead of black, making it look softer? I ought to try that... Just wondered if anyone knows what the QGroupBox frame style/color actually is?



  • While I wait for a better answer :), I am much happier with:

    QFrame qf;
    qf.setFrameShape(QFrame::Box);
    qf.setStyleSheet("QFrame { border: 1px solid lightgray; }");
    

Log in to reply