Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Replicating double borders with QSS



  • While messing around with stylesheets I came across an image of one which appears to be using double borders around some of the widgets.
    My curiosity got the better of me and now I must know what kind of magic this is!

    Take a close look at the QComboBox and QPushButton and you can see a dark grey border with an inner light grey border.

    I'm aware of the "outline" property, but that doesn't seem to work for anything but QPushButton; even then it's inconsistent.
    I've looked through all the QSS documentation, checked the git repo for this QSS, searched everywhere I could think of and I can't, for the life of me, figure out how this is achieved.

    My hunch is, this is more than just QSS:
    A) Subclassed widgets with custom paint implementation that paints the inner border.
    B) A widget inside a widget with no margins. (CustomCtrlFrame {border: 1px solid black;} CustomCtrlFrame QComboBox {border: 1px solid grey})
    C) Maybe it's a platform-specific style? But then how is it retaining the style with the QSS border applied?

    Suggestions?

    alt text
    https://github.com/Jorgen-VikingGod/Qt-Frameless-Window-DarkStyle



  • Never mind, looks like this hunch was correct.

    C) Maybe it's a platform-specific style? But then how is it retaining the style with the QSS border applied?

    Fusion style handles both borders and applying any sort of QSS will remove the styling entirely.
    The styling for these widgets appear to be handled entirely by style and palette.



  • Never mind, looks like this hunch was correct.

    C) Maybe it's a platform-specific style? But then how is it retaining the style with the QSS border applied?

    Fusion style handles both borders and applying any sort of QSS will remove the styling entirely.
    The styling for these widgets appear to be handled entirely by style and palette.


  • Lifetime Qt Champion

    Hi,

    Currently, the style applying the style sheet replaces the application style completely for the concerned widget(s) so you have to do all the styling yourself in that case.


Log in to reply