<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">sorry for the confusion,<div><br></div><div>the problem has nothing to do with the alignment, but with a column-span &gt; 1.&nbsp;</div><div>I modified the example. w_label is expanding, or better not all space is consumed by w_frame but by both</div><div><br><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px; "><span class="Apple-style-span" style="font-family: 'Helvetica Neue'; font-size: medium; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">layout = QGridLayout(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label =&nbsp;<span style="text-decoration: underline; ">QLabel</span>(label, parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame = QFrame(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame.setSizePolicy(<span style="text-decoration: underline; ">QSizePolicy</span>(<span style="text-decoration: underline; ">QSizePolicy</span>.Expanding,&nbsp;<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label.setSizePolicy(<span style="text-decoration: underline; ">QSizePolicy</span>(<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed,&nbsp;<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed))</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">layout.addWidget(w_label, 0, 0, 1, 2)</span></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px; ">layout.addWidget(w_frame, 0, 1)</span></font></div></span></span></font></div></div></blockquote><div><br></div><div>thanks again,</div><div>michael</div><div><br></div><div><br></div></div></div><div><div>On Oct 6, 2009, at 9:03 PM, Michael Held wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">hi PyQt,<div><br></div><div>I have a problem with QGridLayout and AlignRight when enforcing a non-expanding behavior of QLabel.</div><div><br></div><div>this example works as expected: w_label is left-aligned, w_frame is expands horizontally, w_label not</div><div><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">layout = QGridLayout(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label = <span style="text-decoration: underline">QLabel</span>(label, parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame = QFrame(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame.setSizePolicy(<span style="text-decoration: underline; ">QSizePolicy</span>(<span style="text-decoration: underline; ">QSizePolicy</span>.Expanding,&nbsp;<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label.setSizePolicy(<span style="text-decoration: underline">QSizePolicy</span>(<span style="text-decoration: underline">QSizePolicy</span>.Fixed, <span style="text-decoration: underline">QSizePolicy</span>.Fixed))</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">layout.addWidget(w_label, 0, 0)</span></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;">layout.addWidget(w_frame, 0, 1)</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><span class="Apple-style-span" style="font-family: 'Helvetica Neue'; font-size: medium; "><div>here w_label is right-aligned, w_frame expands&nbsp;horizontally, BUT w_label expands as well. why???</div><div><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">layout = QGridLayout(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label =&nbsp;<span style="text-decoration: underline; ">QLabel</span>(label, parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame = QFrame(parent)</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_frame.setSizePolicy(<span style="text-decoration: underline; ">QSizePolicy</span>(<span style="text-decoration: underline; ">QSizePolicy</span>.Expanding,&nbsp;<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">w_label.setSizePolicy(<span style="text-decoration: underline; ">QSizePolicy</span>(<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed,&nbsp;<span style="text-decoration: underline; ">QSizePolicy</span>.Fixed))</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">layout.addWidget(w_label, 0, 0, Qt.AlignRight)</span></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px; ">layout.addWidget(w_frame, 0, 1)</span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><span class="Apple-style-span" style="font-family: 'Helvetica Neue'; font-size: medium; "><div>thanks a lot!</div><div>michael</div><div><br></div></span></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div></span></span></font></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "></span>&nbsp;</div></div>_______________________________________________<br>PyQt mailing list &nbsp;&nbsp;&nbsp;<a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br><a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Helvetica Neue'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><br class="Apple-interchange-newline">-----------------------------------------------------------------------------------------------------------</div><div><span class="Apple-style-span" style="font-family: 'Courier New'; font-size: 12px; ">Michael Held</span></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Gerlich Group, ETH Zurich</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">Institute of Biochemistry</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">HPM D11.1, Schafmattstrasse 18</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">8093 Zurich, Switzerland</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">t = { HPM_D11 : +41 44 63 26 900&nbsp;</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">&nbsp;&nbsp; &nbsp; &nbsp;mobile &nbsp;: +41 77 43 13 906 }</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">f = +41 44 632 1591&nbsp;</span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">m = <a href="mailto:michael.held@bc.biol.ethz.ch">michael.held@bc.biol.ethz.ch</a></span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; ">w = <a href="http://www.bc.biol.ethz.ch/people/groups/gerlichd/people/miheld">http://www.bc.biol.ethz.ch/people/groups/gerlichd/people/miheld</a></span></font></div><div><font class="Apple-style-span" face="'Courier New'" size="3"><span class="Apple-style-span" style="font-size: 12px; "><span class="Apple-style-span" style="font-family: 'Helvetica Neue'; font-size: medium; ">-----------------------------------------------------------------------------------------------------------</span></span></font></div></span>
</div>
<br></body></html>