Qt 6.11 is out! See what's new in the release
blog
Qt creator: Widget [SOLVED]
General and Desktop
9
Posts
4
Posters
3.0k
Views
1
Watching
-
The "easy" solution would be to just get the size of the parent - using getSize() or width(),height() member fns - and set the size of your widget to be 80% of that. Something like this:
@
QWidget* parent = new QWidget();
QWidget* myWidget = new QWidget(parent);
myWidget->setFixedSize(parent->width()*0.8, parent->height()*0.8);@If your parent widget is resizable, you may need to subclass QWidget for your child widget and reimplement resizeEvent().
EDIT: myWidget->resize() is probably better than myWidget->setFixedSize().