Results 1 to 2 of 2

Thread: Using QStyle for QPushButton with 3 background images.

  1. #1
    Join Date
    Jul 2010
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Question Using QStyle for QPushButton with 3 background images.

    Hello everyone,

    Let me start out by saying that I read the docs and the Norwegian Wood example for using QStyle, but it is my first attempt at it, and I would like to know what the best approach to do this is.

    I need to style a QPushButton, and I have 3 complex images for it, left, mid, and right. In the examples I've seen so far people have had one background images that they painted on the widget, and then either drew borders or used darkened painters over it to get what they needed.

    How do people usually style widgets with varied length and multiple background images (mid is supposed to be repeating)? Do you do math and then fill in the right coordinates in the paint events?

    I am faced with an application that relied on style sheets, but it grew into a mess that is now getting very unmaintainable.

    Thanks for any input!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using QStyle for QPushButton with 3 background images.

    Do you do math and then fill in the right coordinates in the paint events?
    I guess yes... You can also have a look at Qt source code as how they do it...am not sure which class though

Similar Threads

  1. QPushButton color and background
    By satanowicz in forum Newbie
    Replies: 4
    Last Post: 25th May 2010, 20:56
  2. Customizing a dialogs background with QStyle
    By SebastianBecker in forum Qt Programming
    Replies: 5
    Last Post: 10th September 2009, 13:11
  3. How to set my QPushbutton's background?
    By cspp in forum Qt Programming
    Replies: 18
    Last Post: 24th April 2009, 15:23
  4. QPushbutton background color
    By omega36 in forum Qt Programming
    Replies: 27
    Last Post: 31st October 2008, 12:47
  5. QTextDocument and background-images
    By pfusterschmied in forum Newbie
    Replies: 0
    Last Post: 1st June 2007, 19:26

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.