Results 1 to 6 of 6

Thread: How to stretch background image used in brush-palette

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    13

    Default How to stretch background image used in brush-palette

    I am trying to make a header label with text over a background image. I'm using the image like a spacer image, so it should stretch the width of the label. I have been able to get the image in the background; however I can't figure out how to make it stretch. Here is the code:

    Qt Code:
    1. palette = QtGui.QPalette()
    2.  
    3. brush = QtGui.QBrush(QtGui.QColor(170, 255, 0))
    4. brush.setTexture(QtGui.QPixmap("Images/small_border.png"))
    5. brush.setStyle(QtCore.Qt.TexturePattern)
    6. palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
    7.  
    8. self.ui.label_2.setPalette(palette)
    To copy to clipboard, switch view to plain text mode 
    The image is being displayed in the TexturePattern, just as it should given the style. However I don't see a way to set the style so that it will stretch the image to fill the space. How can I do that?

    Thanks
    Last edited by jpn; 17th December 2008 at 17:50. Reason: missing [code] tags

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.