PDA

View Full Version : (qt4 & xp) qlabel as background in designer



incapacitant
5th March 2006, 11:30
I read in the forum that to set the background of a form in designer the QLabel can be used.
It does but then I do not see my other controls that are behind the QLabel.

How can I tell designer that the Qlabel should be behind and that the controls should be in front ?

wysota
5th March 2006, 11:56
Hmm... It's not a good idea to use QLabel for this. Who told you that? You can set a pixmap as a background of a widget directly using QWidget's methods.

incapacitant
5th March 2006, 12:00
Well yes I can use the code rather than designer but this makes the layout complicated since I have to compile several times to obtain a good layout for the other controls.
Does this mean that if a background is needed for a form Designer is useless ?

This was not the case in QT3.
What is the designer based way to have a background as an image ?

wysota
5th March 2006, 12:07
It's not useless. Why? Just change its palette int the constructor when you subclass your form.

incapacitant
5th March 2006, 12:12
As you say I can set the background in the constructor, but then I do not benefit from Designer to position my other controls.
I then have to set their position by several iterations in the code rather than in designer.
That's why i wonder how to do all in designer :
- set the background
- position the various controls over the background.

wysota
5th March 2006, 12:21
As you say I can set the background in the constructor, but then I do not benefit from Designer to position my other controls.
I then have to set their position by several iterations in the code rather than in designer.
That's why i wonder how to do all in designer :
- set the background
- position the various controls over the background.

You should do the other way round. First position all the widgets and then apply a background. Remember that you can apply a part of the background to each one of them, so it shouldn't be hard.

Of course, it's a pitty we can't set non-colour palette items in designer.