I have a custom QWidget that displays some number of QSliders, depending on the labels passed into its constructor:
NodeEditBox
(QWidget* _parent, vector<string> _sliderLabels
);
NodeEditBox(QWidget* _parent, vector<string> _sliderLabels);
To copy to clipboard, switch view to plain text mode
So, for example, the box would look like this if 4 labels "X", "Y", "Z", and "theta" were passed in:
ExpandedNode.png
I want to automatically resize the NodeEditBox depending on the number of sliders it will have. One way that works is just doing this right in the beginning of the constructor body:
resize(450, 75*(_sliderLabels.size()));
resize(450, 75*(_sliderLabels.size()));
To copy to clipboard, switch view to plain text mode
...But it doesn't always scale quite right and can look sloppy (e.g., what works nicely for 3 sliders doesn't work for one.) Is there a way I can be more clean about it and just require that the NodeEditBox always displays all of its widgets?
Bookmarks