Important: Please read the Qt Code of Conduct -

Using resources in a .qss doesn't work

  • My .qrc file looks like this:

        <qresource prefix="/">

    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.

  • Moderators

    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);

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

Log in to reply