Results 1 to 2 of 2

Thread: How can Stylesheet reference non resource image file

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How can Stylesheet reference non resource image file

    I want to set a background image for pushbutton,I can do it by using image file from the resource but I want to be able to reference an image file which is not part of resource (.qrc) file. How can I do it? I have tried specifying following code in .ui file directly but it doesn't work.

    Qt Code:
    1. <property name="styleSheet">
    2. <string notr="true">border-image: url(grey_button.JPG);</string>
    3. </property>
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How can Stylesheet reference non resource image file

    You have to use an absolute path or the right relative path. First check with an absolute that your syntax is right, then figure the relative one out and use it.

  3. The following user says thank you to Lykurg for this useful post:

    dpatel (23rd April 2010)

Similar Threads

  1. QPainter.drawImage() not working with resource image file
    By thiagoalencar22 in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2010, 21:07
  2. Qt Resource and StyleSheet Help
    By Peter_APIIT in forum Newbie
    Replies: 0
    Last Post: 19th September 2009, 06:25
  3. Resource file in Qt4.4.0
    By jml in forum Qt Tools
    Replies: 0
    Last Post: 6th May 2008, 18:01
  4. QTextDocument Image resource problem
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 15:28
  5. Resource file in a lib
    By Rodrigo in forum Qt Programming
    Replies: 4
    Last Post: 25th June 2007, 15:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.