Results 1 to 4 of 4

Thread: best way to layer a few buttons over a background image?

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

    Default best way to layer a few buttons over a background image?

    What would you recommend?
    I need to have a background image and a few buttons scattered on top of the image.

    cheers

  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: best way to layer a few buttons over a background image?

    So what is the problem? You can put an image as a background of any widget and you can place widgets (like... say... buttons) in any widget.
    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.


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

    Default Re: best way to layer a few buttons over a background image?

    I was thinking what's the best layout to use if I want to stretch the window and have the image stretching along with the buttons (keeping the same relation of the buttons to the backgroun image)

  4. #4
    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: best way to layer a few buttons over a background image?

    First of all you don't have to use a layout if you don't want to so you can forbid the image from ever resizing. Second of all if the widget gets resized, the background will probably repeat and not stretch if you use what I suggested. To make it stretch, either use stylesheets or subclass the widget and do the painting of the background yourself in a way you want (i.e. stretching the image and keeping its aspect). Finally if you want full control over the placement of the buttons, reimplement the containing widget's resizeEvent() and do the positioning of the buttons yourself (without a layout) by calling resize()/move() or setGeometry().
    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: 1
    Last Post: 25th June 2010, 18:31
  2. Replies: 2
    Last Post: 21st March 2010, 08:20
  3. background image for QWidget
    By raman_31181 in forum Qt Programming
    Replies: 2
    Last Post: 8th March 2008, 11:13
  4. No Background Image on Example
    By igor in forum Qt Programming
    Replies: 3
    Last Post: 19th January 2007, 12:41
  5. [QT4.1.1 XP] background image
    By incapacitant in forum Newbie
    Replies: 3
    Last Post: 1st March 2006, 13:02

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.