[Qt-interest] Bug with Qt Style Sheets?

Eli Hooten elir.hooten at gmail.com
Wed Oct 13 17:03:53 CEST 2010


Frank,

Thank you for the assistance. You mention using the full path when using
url() to display an image. In my actual implementation, this is what I do,
however, using the full path is not a viable option since this software will
be used across multiple machines and the absolute path to the image could
vary from machine to machine. This is why I'm attempting to get it working
using the QT resource system, which is demonstrated in the documentation for
Qt style sheets with the following example:

 /* implicitly sets the size of down-button to the size of spindown.png */
 QSpinBox::down-button { image: url(:/images/spindown.png) }

This assumes, of course, that you're using a qrc file that actually contains
the path to the image spindown.png. However, when using the qt resource
system like in the example above, my images do not appear. So, perhaps there
is some bug related to qrc files and Qt Style Sheets or I am just doing it
wrong? I have not investigated this issue thoroughly enough to be sure. Has
anyone else noticed difficulties with Qt Style Sheets and the resource
system?

Also note, using full paths for both image tags still does not solve my
initial problem. The image appears for the down arrow of a QScrollBar, but
not for the top one.

TL;DR: Either there's a bug with using the Qt Resource System with Qt Style
Sheets to place images on widget subcomponents, or I'm doing it wrong. Also,
it seems that I am not able to replace the default image on the up button of
a QScrollBar widget, but I can replace the down default image. Any thoughts?

Thanks again,
Eli






On Wed, Oct 13, 2010 at 4:11 AM, Frank Lutz <frank422542 at googlemail.com>wrote:

> On my TreeView i do take:
>
> QTreeView::branch:has-children:!has-siblings:closed,
> QTreeView::branch:closed:has-children:has-siblings {
>        border-image: none;
>        image: url(<Path>/image/branch-closed.png);
> }
>
> QTreeView::branch:open:has-children:!has-siblings,
> QTreeView::branch:open:has-children:has-siblings  {
>        border-image: none;
>        image: url(<Path>/image/branch-open.png);
> }
>
> And replace <Path> with the full path. For more information
> maybe you will find sonething in ther documentation. Else
> sorry i couldn't help you.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101013/97179c68/attachment.html 


More information about the Qt-interest-old mailing list