I delete item on this way :
/* on item before delete */
setData(nummerhash,"ping");
GraphicsScene *sc = qobject_cast<GraphicsScene *>(scene());
sc->removeIdItem(AbsoluteLayerRemoveHashID);
}
/* send a ID to this to remove it.. */
void GraphicsScene::removeIdItem( const int idchunk )
{
QList<QGraphicsItem*> subLevelItems;
/* loop all elemenst */
{
subLevelItems << item;
if (item->parentItem())
{
QList<QGraphicsItem *> des = item->childItems();
{
subLevelItems << de;
}
}
}
/* serialize to undo ?? */
const QString chunk
= it
->data
(idchunk
).
toString();
if (chunk.size() > 3) {
delete it;
}
}
}
/* to remove all it running ok from qt4.4 > */
void GraphicsScene::clear()
{
clearSelection();
storno();
}
/* on item before delete */
setData(nummerhash,"ping");
GraphicsScene *sc = qobject_cast<GraphicsScene *>(scene());
sc->removeIdItem(AbsoluteLayerRemoveHashID);
}
/* send a ID to this to remove it.. */
void GraphicsScene::removeIdItem( const int idchunk )
{
const QList<QGraphicsItem*> items = QGraphicsScene::items();
QList<QGraphicsItem*> subLevelItems;
/* loop all elemenst */
foreach(QGraphicsItem* item, items)
{
subLevelItems << item;
if (item->parentItem())
{
QList<QGraphicsItem *> des = item->childItems();
foreach(QGraphicsItem* de,des)
{
subLevelItems << de;
}
}
}
foreach(QGraphicsItem* it, subLevelItems) {
/* serialize to undo ?? */
const QString chunk = it->data(idchunk).toString();
if (chunk.size() > 3) {
delete it;
}
}
}
/* to remove all it running ok from qt4.4 > */
void GraphicsScene::clear()
{
clearSelection();
QGraphicsScene::clear();
storno();
}
To copy to clipboard, switch view to plain text mode
Bookmarks