Results 1 to 13 of 13

Thread: How to display listbox, texbox etc over an image.

  1. #1
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default How to display listbox, texbox etc over an image.

    hi,


    How to display listbox, texbox etc over an image?

    Can i use QGridLayout for this?

    Help plz..


    Mahe2310

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to display listbox, texbox etc over an image.

    Set background pixmap for widget that will be parent for your elements by using setPaletteBackgroundPixmap

    p.s. i dont know is ts possible in Qt/Embedded
    a life without programming is like an empty bottle

  3. #3
    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: How to display listbox, texbox etc over an image.

    Which version do you use?

  4. #4
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display listbox, texbox etc over an image.

    Quote Originally Posted by wysota
    Which version do you use?
    Version Qt-2.3.2

  5. #5
    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: How to display listbox, texbox etc over an image.

    Try using setBackgroundPixmap() for your widget.

  6. #6
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display listbox, texbox etc over an image.

    Quote Originally Posted by zlatko
    Set background pixmap for widget that will be parent for your elements by using setPaletteBackgroundPixmap

    p.s. i dont know is ts possible in Qt/Embedded

    yea.. it worked...

    Can you tell me how to set the size of a list box?

    Mahe2310

  7. #7
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to display listbox, texbox etc over an image.

    use resize()
    a life without programming is like an empty bottle

  8. #8
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display listbox, texbox etc over an image.

    Quote Originally Posted by zlatko
    use resize()

    Qt Code:
    1. QGridLayout * g = new QGridLayout( this, 2, 2, 0);
    2.  
    3.  
    4. QPixmap pixmap = image;
    5. this->setPaletteBackgroundPixmap ( pixmap );
    6.  
    7. as = new QListBox( this );
    8. g->addWidget( as, 1, 1 );
    9. as->resize(25,30);
    To copy to clipboard, switch view to plain text mode 

    but nothing happens....

    Mahe2310

  9. #9
    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: How to display listbox, texbox etc over an image.

    If you use layouts, you shouldn't try to change widget's size. If you really need to, you can try to force the widget to change its sizeHint() (but you'll probably have to subclass).

  10. #10
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display listbox, texbox etc over an image.

    Quote Originally Posted by wysota
    If you use layouts, you shouldn't try to change widget's size. If you really need to, you can try to force the widget to change its sizeHint() (but you'll probably have to subclass).

    I didnt get u? Can you explain?

  11. #11
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: How to display listbox, texbox etc over an image.

    I cant understand you....if you want resize your elements manually why are you use layouts?
    Layout its mechanizm that take care about resize from users sholders, and you cant call resize by own.
    a life without programming is like an empty bottle

  12. #12
    Join Date
    Jan 2006
    Posts
    80
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to display listbox, texbox etc over an image.

    Quote Originally Posted by zlatko
    I cant understand you....if you want resize your elements manually why are you use layouts?
    Layout its mechanizm that take care about resize from users sholders, and you cant call resize by own.

    I displayed a list box, and two Push Buttons on my window. List box grows from starting i specified to the
    point just top of one of the Push Button. I just want to reduce the size of the listbox so that it looks neat on
    the Screen.

    Mahe2310

  13. #13
    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: How to display listbox, texbox etc over an image.

    So try setting the maximum size the box can take. This way it'll not expand more. Or change the size policy to Maximum or Preffered.

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

    mahe2310 (6th March 2006)

Similar Threads

  1. Replies: 2
    Last Post: 29th September 2008, 00:08
  2. Replies: 7
    Last Post: 13th August 2008, 18:27
  3. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  4. Display only PNG image on desktop
    By durbrak in forum Qt Programming
    Replies: 32
    Last Post: 15th March 2008, 21:55
  5. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36

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.