PDA

View Full Version : Widget not showing



kaushal_gaurav
24th July 2008, 08:34
Hi,

I have a template class


template< class WIDGET >
class WidgetItem : public WIDGET, public QGraphicsItem


it can accept any widget as parameter... Now i pass MyWidget class derived from QWidget as a parameter. Now it should treat MyWidget as a widget...
But ... All other widgets like... QPushButton, QLabel etc are shown but MyWidget is not shown...

I have tried doing brute force debuging by setting wait cursor on my widget..
The cursor is changed tp wait cursot but the widget is not shown...


Please help..

salmanmanekia
24th July 2008, 08:42
i am not sure about it,but give this a try when you want to pass QWidget derived class as your WIDGET.


template< class WIDGET >
class WidgetItem : public QGraphicsItem,public WIDGET

Hope it helps...!!

aamer4yu
24th July 2008, 08:57
Why are you creating such a template ??

Wont there be ambiguity between WIDGET and QGraphicsItem functions ?? say mousePressEvent ??

kaushal_gaurav
24th July 2008, 09:37
This is a legacy code...and i have to live with it...
Ambugity is resolved by using scope resolutiion....
But why is this problem.....of not showing the widget...?