[PyQt] QGridLayout AlignRight problem

Michael Held michael.held at bc.biol.ethz.ch
Tue Oct 6 20:03:14 BST 2009


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



  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091006/7ce60105/attachment.html


More information about the PyQt mailing list