Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to access stylesheet properties

How to access stylesheet properties

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 386 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr MinimalEffort
    wrote on last edited by
    #1

    Hi I am updating some custom QWidgets to properly respect styles/stylesheets and want to know the correct way to do this.
    Is there a way to access the resolved stylesheet properties in the paint event?
    I can access custom properties via qproperty-propertyname, and color properties that get dumped into the palette, but what about other properties like border-width/color?
    I'd rather not have qproperty-border-width.

    I do see the data is stored on QRenderRule inside QStyleSheetStyle, but that is not exposed to the public API.

    Alternatively is there a way to override QStyle in a way that custom primitives/controls can be drawn according to stylesheet inputs in situations where custom painting is preferred over raw primitives.
    Thanks!

    Kind Regards
    -Mr MinimalEffort

    (Windows 10, Qt-6.2, QtCreator-5.x)

    JonBJ 1 Reply Last reply
    0
    • M Mr MinimalEffort

      Hi I am updating some custom QWidgets to properly respect styles/stylesheets and want to know the correct way to do this.
      Is there a way to access the resolved stylesheet properties in the paint event?
      I can access custom properties via qproperty-propertyname, and color properties that get dumped into the palette, but what about other properties like border-width/color?
      I'd rather not have qproperty-border-width.

      I do see the data is stored on QRenderRule inside QStyleSheetStyle, but that is not exposed to the public API.

      Alternatively is there a way to override QStyle in a way that custom primitives/controls can be drawn according to stylesheet inputs in situations where custom painting is preferred over raw primitives.
      Thanks!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Mr-MinimalEffort
      Unless you get a more knowledgeable answer: as far as I know stylesheet rules, and implementation, are a "black box" --- internal code which you cannot access.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved