How to vertically center align the QLabel and a QWidget of a QFormLayout row ?
-
HI guys, as the title says :
How to vertically center align the QLabel and a QWidget of a QFormLayout row ?in each row, there is the QLabel on the left column, and on the right I use a custom QWidget that host several QPushButtons displaying only an icon (which size is manually set at the button creation).
The hierarchy of the custom QWidget could be described as this
Custom(QWidget) : layout : QHBoxLayout IconButton ...
I've tried to apply to each
QLabel
int theQFormLayout
:widget.setAlignement(Qt.AlignmentFlag.AlignVCenter)
however the vertical alignement between the Label on the left side and the widget on the right side remain set to their respective top.Ad before drowning you with everything else I tried, maybe one of you had already faced such a situation.
-
-
@SGaist Well... that was worth a shot, but nope, does not change a thing.
QFormLayout.setLabelAlignment()
does handle the horizontal alignment
AndQFormLayout.setFormAlignment()
handles the alignment of where the set of rows begin and end, so it's not the vertical alignment of both elements of a single row...Hmmm... I'll take the time to look at the docs more attentively, without rush... regardless, thanks.
-
Then the next step would likely be to create a custom QProxyStyle that handle that part.
-