In QT Designer, how to center a widget in a horizontal layout?
Unsolved
General and Desktop
-
For example the QLineEdit in the middle is off center because there's a QLabel to the left, but I want the line edit to be in the middle:
Or here I want the "MIDI Output Mode" widget in the middle as well, but since the other widgets are different sized, it gets placed off center:
In both examples the widgets are in a QFrame which has the horizontal layout applied to it.
-
Use nested layouts. The outer horizontal layout has 3 columns with the line edit in the middle. For the first example you gave there would be nested horizontal layout in the first column containing the spacer and the label. The outer layout will try to equally space everything. However, below a certain size the layout might still become asymmetric.