Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

bool ItemDocument::registerItem ( QCanvasItem *  qcanvasItem  )  [virtual]

Attempt to register the item, returning true iff successful

Reimplemented in ICNDocument, and MechanicsDocument.

Definition at line 115 of file itemdocument.cpp.

References itemAdded(), itemSelected(), itemUnselected(), and requestEvent().

Referenced by MechanicsDocument::registerItem(), and ICNDocument::registerItem().

{
      if (!qcanvasItem)
            return false;
      
      requestEvent( ItemDocument::ItemDocumentEvent::ResizeCanvasToItems );
      
      switch (qcanvasItem->rtti())
      {
            case ItemDocument::RTTI::DrawPart:
            case ItemDocument::RTTI::CNItem:
            {
                  Item *item = dynamic_cast<Item*>(qcanvasItem);
                  m_itemList.append(item);
                  connect( item, SIGNAL(removed(Item*)), this, SLOT(requestRerouteInvalidatedConnectors()) );
                  connect( item, SIGNAL(selected(Item*,bool)), this, SIGNAL(itemSelected(Item*)) );
                  connect( item, SIGNAL(unselected(Item*,bool)), this, SIGNAL(itemUnselected(Item*)) );
                  itemAdded(item);
                  return true;
            }
            default:
                  return false;
      }
}


Generated by  Doxygen 1.6.0   Back to index