[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: QTabBar tab text painting?
From:       Maurizio Berti <maurizio.berti () gmail ! com>
Date:       2021-06-05 18:37:50
Message-ID: CAPn+-XS+QacBgHCGVuG58PSYc2WbZCM4sEJfRvkz93v8=Ozy3g () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Il giorno sab 5 giu 2021 alle ore 19:59 Matic Kukovec <
kukovecmatic@hotmail.com> ha scritto:

> But there is a workaround: do NOT set any color settings in the stylesheet
> concerning the text color (the *color* attribute) and
> then use *QTabBar.setItemTextColor *on each tab and painting the current
> tab's background manually, every time something changes in the tab bar
> layout (tabInserted, tabRemoved, ...).
>

Ooops, I completely forgot about that. (I believe you
meant setTabTextColor, by the way).



> Now another issue has come up. When click&dragging an active tab, the drag
> image is that of the stylesheet painted tab,
> not the image of the "blue" one that is actually painted in the tab bar:
> The image is a white background and white text, that's why it looks like
> the text disappears.
> I have no idea where this image is set. Is there a way to fix this?
>

The dragged tab is actually a "fake" tab, it's a QWidget that shows a
pixmap drawn internally using drawControl (and this is a good reason for
which using a proxy style might solve many problems).
I answered a related question on StackOverflow some time ago, you might
have a look at it, at least to understand how it works:
https://stackoverflow.com/a/64346097

Maurizio
-- 
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net

[Attachment #5 (text/html)]

<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Il giorno sab 5 giu 2021 \
alle ore 19:59 Matic Kukovec &lt;<a \
href="mailto:kukovecmatic@hotmail.com">kukovecmatic@hotmail.com</a>&gt; ha \
scritto:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">




<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"><span \
style="font-size:12pt">But there is a workaround: do NOT set any color settings in \
the stylesheet concerning the text color (the </span><i \
style="font-size:12pt"><b>color</b></i><span style="font-size:12pt"> attribute) \
and</span><br></div> <div \
style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"> \
then use <i><b>QTabBar.setItemTextColor </b></i>on each tab and painting the current \
tab&#39;s background manually, every time something changes in the tab bar layout \
(tabInserted, tabRemoved, ...).</div></div></blockquote><div><br></div><div>Ooops, I \
completely forgot about that. (I believe you meant  setTabTextColor, by the \
way).</div><div><br></div><div>  </div><blockquote class="gmail_quote" \
style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div \
style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"> Now \
another issue has come up. When click&amp;dragging an active tab, the drag image is \
that of the stylesheet painted tab,</div> <div \
style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"> not \
the image of the &quot;blue&quot; one that is actually painted in the tab bar:</div> \
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
 <img size="35855" style="max-width: 100%;" src="cid:179dd7237d8e53d1aa24"></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
 The image is a white background and white text, that&#39;s why it looks like the \
text disappears.</div> <div \
style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)"> I \
have no idea where this image is set. Is there a way to fix \
this?</div></div></blockquote><div><br></div><div>The dragged tab is actually a \
&quot;fake&quot; tab, it&#39;s a QWidget that shows a pixmap drawn internally using \
drawControl (and this is a good reason for which using a proxy style might solve many \
problems).</div><div>I answered a related question on StackOverflow some time ago, \
you might have a look at it, at least to understand how it works: <a \
href="https://stackoverflow.com/a/64346097">https://stackoverflow.com/a/64346097</a></div><div><br></div><div>Maurizio</div></div>-- \
<br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa \
quando si parla delle ragioni del cuore. - &quot;Sostiene Pereira&quot;, Antonio \
Tabucchi<br><a href="http://www.jidesk.net" \
target="_blank">http://www.jidesk.net</a></div></div></div></div>


["HnqEFErt5F.gif" (image/gif)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic