PDA

View Full Version : How can I put a button onto the qLabel?



dwlnet
24th August 2007, 03:19
Hello everyone,
thank you to view my Thread first!

I'm a new learning qt4.I have an issue mentioned in the title.
I want to put a qPushButton onto the qLabel,but at fist the button can't display because the button is at the label's position. I try many times and surprisingly the button display on the label which I don't make any modification!But there is still a problem:this button can't received the clicked signal.How can I slove the problem?
Is there any functions in QT4 to change the control's order or slove my problem ?

Can you help me? Thank you!

dwlnet
24th August 2007, 03:22
Once I uesd the Qt::WindowStaysOnTopHint flag,
raise()
grabMouse ()
activateWindow () and so on.
but there is no effect.

jpn
24th August 2007, 10:21
Create the button as child of the label:

QPushButton* button = new QPushButton("Title", label);

sunil.thaha
24th August 2007, 10:47
I think you can use style sheets also for this. The following link expalin how to put a button inside linedit. I think you can do the same for label

http://labs.trolltech.com/blogs/2007/06/06/lineedit-with-a-clear-button/