Results 1 to 2 of 2

Thread: Scaling background image using styleSheet ? or any other way?

  1. #1
    Join Date
    May 2010
    Posts
    9
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question Scaling background image using styleSheet ? or any other way?

    I'm trying to resize a background image on a button

    Qt Code:
    1. btn.setStyleSheet("background-image: url(:/AddButton.png);"
    2. "background-repeat: no-repeat;")
    To copy to clipboard, switch view to plain text mode 

    tried it with

    Qt Code:
    1. background-size: 10px auto;
    To copy to clipboard, switch view to plain text mode 

    but pyqt seems to be missing this CSS attribute

    Is there any other way of scaling the background image on the button? I need the background image as the icon on the button will be used on top.

    any suggestions?

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

    Default Re: Scaling background image using styleSheet ? or any other way?

    Why don't you just use QAbstractButton::icon property?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 5
    Last Post: 10th October 2012, 21:05
  2. QWebView and image scaling
    By naresh in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2010, 03:38
  3. Setting QDial background image using stylesheet
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 28th April 2010, 13:13
  4. Replies: 1
    Last Post: 7th October 2007, 23:02
  5. Fast image drawing/scaling in Qt 3.3
    By eriwik in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 10:45

Tags for this Thread

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.