Changing QTabBar::tab border color breaks the width & padding?
-
I was styling my app and ran into some weird behavior when trying to override border colors, and was able to narrow it down to this minimal example...
With no styling my tabs look like this:
But when I apply any border related styling like the snippet below, it changes to this:
QTabBar::tab { border-color: black; }
Can anyone please help me understand why this is happening? I'd like to change colors without side-effects like this
-
Without stylesheet a platform plugin is used to draw controls. When you set a border with qss the style for the control is changed to use the qss style with everything you didn't set left at defaults (no border, transparent background, no padding etc.).
Text color is sort of an exception, because it only overrides the palette, but for the most part when you use stylesheets it's all or nothing. If you want a custom qss border you need to recreate the rest of the native look i.e. set border (not just color), background and padding. -
Without stylesheet a platform plugin is used to draw controls. When you set a border with qss the style for the control is changed to use the qss style with everything you didn't set left at defaults (no border, transparent background, no padding etc.).
Text color is sort of an exception, because it only overrides the palette, but for the most part when you use stylesheets it's all or nothing. If you want a custom qss border you need to recreate the rest of the native look i.e. set border (not just color), background and padding.