I've been trying to make a QVBoxLayout act like a QFormLayout so that when I add widgets to the QVBoxLayout, they do not stretch across the length of the parent widget. I've been trying to do this with sizePolicies, sretchFactors, etc, but I can't seem to figure it out.
Here's my code:
Qt Code:
layout->addWidget(thing1); layout->addWidget(thing2); layout->addWidget(thing3); widget->resize(300,300); widget->setLayout(layout); widget->show();To copy to clipboard, switch view to plain text mode
Output using a QFormLayout:
Output using a QVBoxLayout:
I'd like the QVBoxLayout version to mimic the QFormLayout version.
Bookmarks