Vertical Tabbar, with horizontal text, not getting the right Palette
Unsolved
General and Desktop
-
Hi there.. again..
I managed to change my Fusion Style color palette from light to dark and vise versa.
But now, i stumble across another Problem with that Method.In some of my Windows, i need a vertical TabBar, that holds Tabs with Horizontal Text.
To achive this, i took this snippet of code:#include <QProxyStyle> class WestTabH_Text : public QProxyStyle { public: QSize sizeFromContents(ContentsType type, const QStyleOption* option, const QSize& size, const QWidget* widget) const { QSize s = QProxyStyle::sizeFromContents(type, option, size, widget); if (type == QStyle::CT_TabBarTab) { s.transpose(); } return s; } void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const { if (element == CE_TabBarTabLabel) { if (const QStyleOptionTab* tab = qstyleoption_cast<const QStyleOptionTab*>(option)) { QStyleOptionTab opt(*tab); opt.shape = QTabBar::RoundedNorth; QProxyStyle::drawControl(element, &opt, painter, widget); return; } } QProxyStyle::drawControl(element, option, painter, widget); } };
And set it as Style for the TabBar
ui->TabView_Database->tabBar()->setStyle(new WestTabH_Text);
Looks great in standard fusion light Theme... but gives me a Problem in the dark one.. see:
I´m not familiar with the Palette and Style thing.. so it would be nice, if you People can help me out here.. How can i set the Style of the TabBar to fit the current Palette?
-
Hi,
My guess is that it still wraps the previous style.
I would recreate the proxy style when switching between your themes.