Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QFrame box style

    General and Desktop
    2
    4
    166
    Loading More Posts
    • 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.
    • JonB
      JonB last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        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; }");
        
        1 Reply Last reply Reply Quote 0
        • B
          Bonnie last edited by Bonnie

          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.

          JonB 1 Reply Last reply Reply Quote 1
          • JonB
            JonB @Bonnie last edited by

            @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?

            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              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; }");
              
              1 Reply Last reply Reply Quote 0
              • First post
                Last post