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
{
// first, get the rect instance that sent the signal
GatewayRectItem * rect = qobject_cast< GatewayRectItem * >(sender());
// rect->setBrush(QBrush(Qt::black));
QList<QGraphicsItem*> stackOfRect = scene->items();
int indexOfShape = stackOfRect.indexOf(rect);// trying to index the clicked rect
if (CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape)))// getTitle is looking for the index clicked
{
// create link ctrl widget
//C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(indexOfShape);
const C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape));
showLinkToolBoxWidget(pState->m_strLinkId);
}
}
void GatewayWidget::onRectDoubleClicked(QGraphicsSceneMouseEvent * event)
{
// first, get the rect instance that sent the signal
GatewayRectItem * rect = qobject_cast< GatewayRectItem * >(sender());
// rect->setBrush(QBrush(Qt::black));
QList<QGraphicsItem*> stackOfRect = scene->items();
int indexOfShape = stackOfRect.indexOf(rect);// trying to index the clicked rect
if (CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape)))// getTitle is looking for the index clicked
{
// create link ctrl widget
//C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(indexOfShape);
const C2DM::LinkState *pState = CORE::castPtrType<C2DM::LinkState>(m_pLinkStateListModel->getTitle(indexOfShape));
showLinkToolBoxWidget(pState->m_strLinkId);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks