sorry for the confusion,

the problem has nothing to do with the alignment, but with a column- span > 1. I modified the example. w_label is expanding, or better not all space is consumed by w_frame but by both

layout = QGridLayout(parent)
w_label = QLabel(label, parent)
w_frame = QFrame(parent)
w_frame.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)) w_label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
layout.addWidget(w_label, 0, 0, 1, 2)
layout.addWidget(w_frame, 0, 1)

thanks again,
michael


On Oct 6, 2009, at 9:03 PM, Michael Held wrote:

hi PyQt,

I have a problem with QGridLayout and AlignRight when enforcing a non-expanding behavior of QLabel.

this example works as expected: w_label is left-aligned, w_frame is expands horizontally, w_label not

layout = QGridLayout(parent)
w_label = QLabel(label, parent)
w_frame = QFrame(parent)
w_frame.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)) w_label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
layout.addWidget(w_label, 0, 0)
layout.addWidget(w_frame, 0, 1)


here w_label is right-aligned, w_frame expands horizontally, BUT w_label expands as well. why???

layout = QGridLayout(parent)
w_label = QLabel(label, parent)
w_frame = QFrame(parent)
w_frame.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)) w_label.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))
layout.addWidget(w_label, 0, 0, Qt.AlignRight)
layout.addWidget(w_frame, 0, 1)


thanks a lot!
michael




_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt


-----------------------------------------------------------------------------------------------------------
Michael Held
Gerlich Group, ETH Zurich
Institute of Biochemistry
HPM D11.1, Schafmattstrasse 18
8093 Zurich, Switzerland
t = { HPM_D11 : +41 44 63 26 900
      mobile  : +41 77 43 13 906 }
f = +41 44 632 1591
m = [email protected]
w = http://www.bc.biol.ethz.ch/people/groups/gerlichd/people/miheld
-----------------------------------------------------------------------------------------------------------

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to