PDA

View Full Version : How to display listbox, texbox etc over an image.



mahe2310
3rd March 2006, 12:25
hi,


How to display listbox, texbox etc over an image?

Can i use QGridLayout for this?

Help plz..


Mahe2310

zlatko
3rd March 2006, 12:30
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

wysota
3rd March 2006, 12:32
Which version do you use?

mahe2310
3rd March 2006, 12:59
Which version do you use?
Version Qt-2.3.2

wysota
3rd March 2006, 13:14
Try using setBackgroundPixmap() for your widget.

mahe2310
3rd March 2006, 13:40
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

zlatko
3rd March 2006, 14:04
use resize()

mahe2310
3rd March 2006, 14:52
use resize()






QGridLayout * g = new QGridLayout( this, 2, 2, 0);


QPixmap pixmap = image;
this->setPaletteBackgroundPixmap ( pixmap );

as = new QListBox( this );
g->addWidget( as, 1, 1 );
as->resize(25,30);



but nothing happens.... :( :confused:

Mahe2310

wysota
3rd March 2006, 14:55
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).

mahe2310
3rd March 2006, 15:19
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?

zlatko
3rd March 2006, 15:42
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.

mahe2310
3rd March 2006, 15:50
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

wysota
3rd March 2006, 16:51
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.