QTabBar tab text painting?
Maurizio Berti
maurizio.berti at gmail.com
Sat Jun 5 19:37:50 BST 2021
Il giorno sab 5 giu 2021 alle ore 19:59 Matic Kukovec <
kukovecmatic at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210605/cc3e8cd2/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HnqEFErt5F.gif
Type: image/gif
Size: 35855 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210605/cc3e8cd2/attachment-0001.gif>
More information about the PyQt
mailing list