Page MenuHome

Wrong layout alignment
Closed, InvalidPublic

Description

System Information
Win10 / GTX 1070

Blender Version
Broken: 2.78

Short description of error
I'm not sure we can consider it as a bug, but the layout alignment doesn't seems to be correct in all situations.
A simple example with row and column can show what seems wrong.

layout = self.layout
col = layout.column(align=True)
row = col.row(align=True)
row.prop(scene, 'prop_a')
row.operator('my_operator.btn')
col.prop(scene, 'prop_b')

Exact steps for others to reproduce the error
Run the script in the attached .blend file and check the result in the sequencer panel.



Details

Type
Bug

Event Timeline

UILayout.row is not enough in this case. You have to use UILayout.split:

scene = context.scene
layout = self.layout
col = layout.column(align=True)
row = col.split(0.3, align=True)
row.label("Prop A")
row = row.row(align=True)
row.prop(scene, 'prop_a', "")
row.operator('my_operator.btn')

row = col.split(0.3, align=True)
row.label("Prop B")
row = row.row(align=True)
row.prop(scene, 'prop_b', "")
row.operator('my_operator.btn', text='', icon='REC')

row = col.split(0.3, align=True)
row.label("Prop C")
row = row.row(align=True)
row.prop(scene, 'prop_c', "")

row = col.split(0.3, align=True)
row.label("Prop D")
row = row.row(align=True)
row.prop(scene, 'prop_d', "")

Or use 2 columns instead of 1:

scene = context.scene
layout = self.layout
row = layout.row(align=True)

col1 = row.column(align=True)
col2 = row.column(align=True)

col1.label("Prop A")
row = col2.row(align=True)
row.prop(scene, 'prop_a', "")
row.operator('my_operator.btn')

col1.label("Prop B")
row = col2.row(align=True)
row.prop(scene, 'prop_b', "")
row.operator('my_operator.btn', text='', icon='REC')

col1.label("Prop C")
row = col2.row(align=True)
row.prop(scene, 'prop_c', "")

col1.label("Prop D")
row = col2.row(align=True)
row.prop(scene, 'prop_d', "")
Bastien Montagne (mont29) closed this task as Invalid.

There is indeed no bug here, as @Aleksandr Zinovev (raa) already explained.

Oh sorry for the bad report!
And thank you for the answer :)