Is it possible to completely remove the title from a QGroupBox
? If you just give it an empty title, the label where the title would be still takes up space. It looks like this:
But I want it to look like this instead:
I tried the following things without success:
setStyleSheet("QGroupBox:title{ max-width: 0; max-height: 0; }");
setStyleSheet("QGroupBox:title{ subcontrol-position: center center;}")
Note: You might say that a group box without title is a use case for QFrame
. The problem with this is that I want to mix groups/frames with and without title, but the frame has a different visual style than the group box. So if you could tell me how to make QFrame
look like QGroupBox
that would solve my problems too.
You could use:
setStyleSheet("QGroupBox{padding-top:15px; margin-top:-15px}")
What you see is a bug of the particular style you're using. This pretty much "works" without you having to do anything special on other common styles (e.g. Mac, Windows). If you insist on using the particular style in question, you'll have to patch it yourself and either copy the style into your project, or build entire Qt to have a fixed version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With