Thank you for your help once more, without your help I would not have progressed this far, I do not take it for granted. It is working , it changes color on doubleclick.

May I please ask another question. Now I want that when I doubleclick on the rect, it must then pop up a widget, but the widget is looking for the index of the rect so that It can pop the widget with the information specific to that rect. I tried it like the code below to get the index of the rect, but it only pops up the widget once(with the correct information). Then nothing after that to any subsequent rect that I click. my question is should I store the indexes of each rect on creation with QLIST[] or how should I store the index of the clicked rect ? i would appreciate your assistance once more


Qt Code:
  1. void GatewayWidget::onRectDoubleClicked(QGraphicsSceneMouseEvent * event)
  2. {
  3. // first, get the rect instance that sent the signal
  4. GatewayRectItem * rect = qobject_cast< GatewayRectItem * >(sender());
  5. // rect->setBrush(QBrush(Qt::black));
  6.  
  7. QList<QGraphicsItem*> stackOfRect = scene->items();
  8.  
  9. int indexOfShape = stackOfRect.indexOf(rect);// trying to index the clicked rect
  10. if (CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape)))// getTitle is looking for the index clicked
  11. {
  12. // create link ctrl widget
  13. //C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(indexOfShape);
  14. const C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape));
  15. showLinkToolBoxWidget(pState->m_strLinkId);
  16.  
  17. }
  18.  
  19.  
  20.  
  21.  
  22. }
To copy to clipboard, switch view to plain text mode