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. Using resources in a .qss doesn't work
Forum Updated to NodeBB v4.3 + New Features

Using resources in a .qss doesn't work

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.8k 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.
  • qwasder85Q Offline
    qwasder85Q Offline
    qwasder85
    wrote on last edited by
    #1

    My .qrc file looks like this:

    <RCC>
        <qresource prefix="/">
            <file>myStyleSheet.qss</file>
            <file>images/scrollIcon.svg</file>
        </qresource>
    </RCC>
    

    In my stylesheet, I use "scrollIcon.svg" like this:

    QScrollBar::right-arrow:horizontal {
    image: url( :/images/scrollIcon.svg );
    width: 10;
    height: 10;
    }

    The "/images/scollIcon.svg" path also reflects the actual path to the icon in the project directory (although I understand that wouldn't even be necessary).
    Why does the icon still not show up? If I use an absolute path as the image source, it's working. I also tried calling ensurePolished() on the widget after applying the stylesheet - same result.

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      i once had the same problem. In my case it was a bug in the stylesheet parser.
      Try to remove the spaces in the url().

      image: url(:/images/scrollIcon.svg);
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      qwasder85Q 1 Reply Last reply
      1
      • raven-worxR raven-worx

        i once had the same problem. In my case it was a bug in the stylesheet parser.
        Try to remove the spaces in the url().

        image: url(:/images/scrollIcon.svg);
        
        qwasder85Q Offline
        qwasder85Q Offline
        qwasder85
        wrote on last edited by
        #3

        @raven-worx Oh wow, thank you so much. I'd buy you a beer right now.

        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