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

Is it possible to add QPen property and stylize it using qss?



  • I'm trying to set color and width to QPen using qss.
    I've added a QPen property like below

    Q_PROPERTY( QPen hoveredContentBorder READ hoveredContentBorder WRITE setHoveredContentBorder NOTIFY hoveredContentBorderChanged )
    

    It doesn't work.
    I also added QBrush property like below and it's working fine.

    Q_PROPERTY( QBrush hoveredContentFill READ hoveredContentFill WRITE setHoveredContentFill NOTIFY hoveredContentFillChanged )
    

    I'm using Qt 5.10.1.
    Thanks in advance :)


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    From a quick look at the current style that renders style sheeted widgets, it seems that there's indeed no support for QPen.

    Can you share a minimal compilable example of what you are trying to achieve ?


Log in to reply