<html><head></head><body 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, <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 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 = <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, <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, 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> </div></body></html>