Deepak Angeshwar wrote:
> 
> 
> All,
> 
> I have created a custom widget which is a label on a widget.
> The label takes in a live price and it flashes (window/text color 
> changes if the price goes up or down)
> 
> This label needs to be on top of a QPushButton, so hat the button shows 
> the price and also flashes.
> 
> Can anyone suggest me how to do this.
> 
> Looks like the button takes only icon/text.
> Whats the best approach to sort this issue.

In Qt all widgets can have children, so the label can simply be a child 
of the button.

label.setParent(button);
label.setGeometry(centeredPositionInButton);

That will position the label on top of the button. You may also have to set

http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/core/Qt.WidgetAttribute.html#WA_TransparentForMouseEvents

on the label for the button to receive its mouse events.

This will not make the label move with the button, though, so a better 
but slightly more complex way is to reimplement the QPushButton and add 
your price-based flasing to its drawing.

best regards,
Gunnar

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to