Reputation: 330
I have QWidget instance (with other QWidgets inside) in Qt 5.8 and I want to set some border around it. Is there some way to do this from C++ without affecting any of it's children and their settings and positions?
I don't want to use stylesheets and it needs to work with any system style.
Upvotes: 6
Views: 14399
Reputation: 1060
You should use QFrame
which inherits QWidget
.
Set Frame::Shape
in the method below to QFrame::Box
. This will produce borders around your Frame:
QFrame::setFrameShape(QFrame::Shape);
Use setLineWidth
to set the line width:
QFrame::setLineWidth(int);
Upvotes: 14