Proper way to inherit QGraphicsProxyWidget



  • Hi ,
    I am trying to inherit QGraphicsProxyWidget so I can add custom QWidget based items to my scene but the application is having problems when quitting.I think the problem has sth to do with parents somehow and the application is having problems when cleaning up before it quits.

    Here is my header:

    @

    class UBGraphicsTableItem :public QObject,public QGraphicsProxyWidget,public UBItem
    {

    public:
    UBGraphicsTableItem(const int & rows,const int & columns);
    virtual ~UBGraphicsTableItem();
    //......

    private:
    QTableWidget * mTableWidget;
    QGraphicsSvgItem* mResizeSvgItem;
    QGraphicsSvgItem* mRotateSvgItem;

    };

    @

    In the cpp file,I simply create tha tableWidget and assign it to the proxy .

    @

    UBGraphicsTableItem::UBGraphicsTableItem(const int & rows,const int & columns)
    :QGraphicsProxyWidget()
    {

     mTableWidget=new QTableWidget(rows,columns);
    
     mTableWidget->setFixedWidth(500);
     setWidget(mTableWidget);
    

    }

    @

    When I comment out everything that relates to the tableWidget ,all works fine suggesting that my tableWidget is not being integrated well with the proxyWidget.Any help would be appreciated as to what I might be doing wrong here.

    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.