Results 1 to 4 of 4

Thread: Qt Stylesheet: border-image attribute ignored by QPushButton (works with QLineEdit)

  1. #1
    Join Date
    Jan 2007
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Unhappy Qt Stylesheet: border-image attribute ignored by QPushButton (works with QLineEdit)

    The subject pretty much says it all. I'm playing around with the Stylesheet-Example-Project with Qt 4.2 but wasn't able to set a border-image for the Buttons. The strange thing is that the lines

    border-image: url(:/images/pushbutton.png) 4;
    border-width: 4px;

    work perfectly for QLineEdit but don't work for QPushButton at all!

    Any help would be greatly appreciated!

    I didn't change much in the example - just loaded the Form in Qt Designer, added the new image to the resource and recompiled everything - I'm using the stylesheet editor in the application itself to play around with it...

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Stylesheet: border-image attribute ignored by QPushButton (works with QLineEdi

    I've seen border-image in action on QPushButtons, so you must have made some mistake. AFAIR the documentation has a working example of using border-images with a push button.

    I just checked in Designer and it works fine for me. Check with an image taken from file, not from a resource.

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

    bjoernbg (28th January 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    10
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt Stylesheet: border-image attribute ignored by QPushButton (works with QLineEdi

    Thanks! Taking the image from file works!!

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Stylesheet: border-image attribute ignored by QPushButton (works with QLineEdi

    Looks like your resource was set up incorrectly and the image didn't exist. Did you link your application with that resource?

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.