Good day everyone

I am struggling to implement a mouseDoubleClickEvent on a QGraphicsRectItems initialized in another class. I have a class called GatewayWidget where i have created the QgraphicsRectItems in a scene using myshape class, but i cannot get the mousedDoubleClickEvent to click on a QgraphicsRectItem on a scene. When i insert a breakpoint at(scene->items()) no items are returned, but the same mouseDoubleClickEvent works when I call a widget(named logWidg) on a doubleclicking of the same QGraphicsRectItem. However when I call on the QGraphicsRectItem to change colour on doubleclick it does not work. please help! I appreciate it advance! please see my code below

Qt Code:
  1. void GatewayWidget::receivedTitlesEx(const QString &_rStrDescription, const CORE::Time &_rSimTime, const QList<std::shared_ptr<DM::Object> > &_rTitles, int _eType)
  2. { // I add my QGraphicsRectItems on the scene here
  3. myshape* shape1 = new myshape(text);
  4. //shape1->setFlag(QGraphicsItem::ItemIsMovable);
  5. shape1->setPos(0, 25);
  6. scene->addItem(shape1);
  7. shape1->setFlag(QGraphicsItem::ItemIsMovable);
  8. shape1->setFlag(QGraphicsItem::ItemIsSelectable);
  9. shape1->setFlag(QGraphicsItem::ItemIsFocusable);
To copy to clipboard, switch view to plain text mode 
}
Qt Code:
  1. void myshape::mouseDoubleClick(QGraphicsSceneMouseEvent *event)
  2. {
  3.  
  4. QGraphicsItem::mousePressEvent(event);
  5.  
  6. GatewayWidget gw; //this is the class that this method is implemented, and also where i have initialized the scene and drawn qgraphicsitems
  7. gw.on_btnSelectItem_clicked(); //on_btnSelectItem_Clicked is the method implemented on Gatewaywidget that is supposed to change QGraphicsRectItem on double click, but it does not work. please help
  8.  
  9. //logWidg = new loginWidget();// but this widget can launch successfully when i click on the QGrapicsRectItem
  10. //logWidg->show();
  11.  
  12. QList<QGraphicsItem*> stackOfShapes = gw.scene->items();// I tried to check if gw can return items but the breakpoint i inserted returns zero items
To copy to clipboard, switch view to plain text mode 

myshape .h file is as follows:
Qt Code:
  1. class myshape :public QObject, public QGraphicsRectItem{
  2.  
  3. public:
  4. myshape(QGraphicsItem *item) {
  5. setPen(QPen(QBrush(Qt::black), 1));
  6. setBrush(QBrush(Qt::green));
  7. setRect(0, 0, 80, 80);
  8.  
  9. }
  10.  
  11. protected:
  12.  
  13. void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
  14.  
  15. private:
  16.  
  17. GatewayWidget *gatew; //i have implemented the myshape::mousedoubleclick event on the class(GatewayWidget)
  18.  
  19.  
  20. virtual QSizeF sizeHint(Qt::SizeHint which,
  21. const QSizeF& constraint = QSizeF()) const {
  22. Q_UNUSED(which);
  23. Q_UNUSED(constraint);
  24. return boundingRect().size();
  25. }
  26.  
  27. virtual void setGeometry(const QRectF& rect) {
  28.  
  29. setPos(rect.center());
  30. }
  31.  
  32.  
  33. };
To copy to clipboard, switch view to plain text mode 

on_btnSelectItem_clicked() is the method i call that is supposed to change colour of QGraphicsRectItem on mouseDoubleClickEvent but it does not work

Qt Code:
  1. void GatewayWidget::on_btnSelectItem_clicked()
  2. {
  3.  
  4. foreach(QGraphicsItem *item, scene->selectedItems())
  5. {
  6.  
  7. QGraphicsRectItem *rect = qgraphicsitem_cast<QGraphicsRectItem *>(item);
  8. if (!rect)
  9. continue;
  10.  
  11. QBrush br(Qt::SolidPattern);
  12. br.setColor(Qt::black);
  13. rect->setBrush(br);
  14. rect->update();
  15. }
  16. }
To copy to clipboard, switch view to plain text mode