Unsolved Is it possible to combine QProxyStyle with QSS?
-
I'm using QProxyStyle to be able to dynamically make a tab's text bold, but this kills my users ability to customise tabs with QSS. Is it possible to merge the two?
-
@Vadi2
no, since QSS is itself a proxy style -
@Vadi2
In that case, can you move yourQProxyStyle
for the bold over to a rule in a pre-supplied base stylesheet you supply? Then the user can still repeat the rule in their own stylesheet to add further styles. -
How can I individually target a tab with QSS?
-
@Vadi2 said in Is it possible to combine QProxyStyle with QSS?:
How can I individually target a tab with QSS?
http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar
you can only select the first or last tab with QSS -
Right, so I have to use QProxyStyle, there is no possibilty to use QSS for it.
How can I combine users QSS with QProxyStyle? If the user wishes to use a dark theme, for example, then my tabs with QProxyStyle do not visually integrate.
-
@Vadi2 said in Is it possible to combine QProxyStyle with QSS?:
How can I combine users QSS with QProxyStyle?
go back and read my first post
You can either use one or the other -
http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar
you can only select the first or last tab with QSSI don't see the "first or last tab" in the docs there. Could you explain? Because if that's true it would stop it being of much use most of the time.
-
@JonB
from here at the QTabBar section:Individual tabs may be styled using the ::tab subcontrol. Close buttons using the ::close-button The tabs support the :only-one, :first, :last, :middle, :previous--selected, :next-selected, :selected pseudo states.
This is sufficient for the usual cases.
Index based selection of the tab isn't supported. I dont know if it can be achieved by subclassing QTabBar and do the painting yourself. Would have to step through the style's painting.
-
@raven-worx
OIC, you mean the OP wishes to change one tab but not another. I did not get that from the question. I thought he was just trying to change to bold on all tabs. Unless he only wants to address the:selected
one? -
A tab's text, so yes indeed a single tab's. Happy to hear solutions on this..
-
@Vadi2
I believe you can accessQTabBar::tab:selected
(in addition to first & last) if that is the one you wish to bold? But you cannot address an arbitrary one by index, if that is what you wanted. -
Yes, I need to be able to access them arbitrarily.