<div dir="ltr"><div>This doesn't seem to be a PyQt related issue.</div><div><br></div><div>I suggest you to provide a proper minimal reproducible code, either here or at least on a Qt forum or StackOverflow post, and eventually share the link here.</div><div><br></div><div>Note that, if you're using QSS, you should always::</div><div>- ensure that you're using proper selectors, especially if the QSS is set on parents or the whole QApplication;</div><div>- remember that styling complex widgets requires setting <b>*all*</b> their properties as soon as even one is set; using generic properties (such as <span style="font-family:monospace">setStyleSheet('background: gray;')</span>) at <b>*any*</b> level above any possibly affected widget may result in unexpected behavior;</div><div>- consider that QSS are always inherited by child widgets, so verify that you're not setting any generic/arbitrary QSS with code or by using a Designer UI;</div><div><br></div><div>Cheers,</div><div>MaurizioB<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno sab 27 apr 2024 alle ore 19:36 Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com">kukovecmatic@hotmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="msg-1237662211449779369">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I apologize, the screenshot for the overriden sizeHint method:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="margin-left:40px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
def sizeHint(self):<br>
return super().sizeHint()*2</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
looks actually like this:</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<img style="max-width: 1062px;" size="16374" src="cid:ii_18f22af1196cb971f164"></div>
<div id="m_-1237662211449779369appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-1237662211449779369divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>><br>
<b>Sent:</b> Saturday, April 27, 2024 7:23 PM<br>
<b>To:</b> <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a> <<a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a>><br>
<b>Subject:</b> Re: QTabWidget rendering issue?</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Also note that any 'repaint', 'polish' and 'unpolish' methods on the QTabBar have no effect in the tab-bar in this state,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
only clicking on another tab renders it correctly.</div>
<div id="m_-1237662211449779369x_appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-1237662211449779369x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>><br>
<b>Sent:</b> Saturday, April 27, 2024 7:09 PM<br>
<b>To:</b> <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a> <<a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a>><br>
<b>Subject:</b> Re: QTabWidget rendering issue?</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I tried overriding the 'sizeHint' method of the QTabBar with this to see what would happen:</div>
<div style="margin-left:40px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="margin-left:40px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
def sizeHint(self):<br>
return super().sizeHint()*2</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
but that only changes the initial tabs to this:</div>
<div style="margin-left:0px;font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<img size="6562" style="max-width: 1062px;" src="cid:ii_18f22af1195cb971f163"></div>
<div id="m_-1237662211449779369x_x_appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-1237662211449779369x_x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>><br>
<b>Sent:</b> Saturday, April 27, 2024 6:50 PM<br>
<b>To:</b> Charles <<a href="mailto:peacech@gmail.com" target="_blank">peacech@gmail.com</a>><br>
<b>Cc:</b> <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a> <<a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a>><br>
<b>Subject:</b> Re: QTabWidget rendering issue?</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Ok, thanks, will do some testing into that direction.</div>
<div id="m_-1237662211449779369x_x_x_appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-1237662211449779369x_x_x_divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Charles <<a href="mailto:peacech@gmail.com" target="_blank">peacech@gmail.com</a>><br>
<b>Sent:</b> Saturday, April 27, 2024 6:34 PM<br>
<b>To:</b> Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a> <<a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a>><br>
<b>Subject:</b> Re: QTabWidget rendering issue?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div style="font-family:arial,helvetica,sans-serif;font-size:small">
Maybe QTabWidget does not compute the sizeHint based on the custom font size?<br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Sat, Apr 27, 2024 at 11:12 PM Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
This happens even without any styling changes, seen here:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<img size="34769" style="max-width: 1062px;" src="cid:ii_18f22af1195cb971f162"></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Note that this is a plain vanilla QTabBar, no sub-classing.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Matic</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-1237662211449779369x_x_x_x_m_-4961569117981197639appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="m_-1237662211449779369x_x_x_x_m_-4961569117981197639divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Matic Kukovec <<a href="mailto:kukovecmatic@hotmail.com" target="_blank">kukovecmatic@hotmail.com</a>><br>
<b>Sent:</b> Saturday, April 27, 2024 12:59 PM<br>
<b>To:</b> <a href="mailto:PyQt@riverbankcomputing.com" target="_blank">PyQt@riverbankcomputing.com</a> <<a href="mailto:pyqt@riverbankcomputing.com" target="_blank">pyqt@riverbankcomputing.com</a>><br>
<b>Subject:</b> QTabWidget rendering issue?</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi guys,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Specs:</div>
<ul>
<li style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Windows 10 x64</div>
</li><li style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Python 3.12</div>
</li><li style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
PyQt 6.6.1</div>
</li></ul>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I have a QTabWidget inside a layout and when initial layout is built not all of tabs are rendered.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
The selected tab is rendered as the first tab, but when I select a different tab, all the tabs render correctly,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
here is an example:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<img size="38763" style="max-width: 1072px;" src="cid:ii_18f22af1195cb971f161"></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
As you can see, when the initial layout is rendered the 'systick.c' tab is shown as the first, but in reality</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
the 'main.c' tab should be first, but it only appears after I click any non-current tab.</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Any idea of where the problem is?</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Regards,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Matic</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div></blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div>