[Interest] QGraphicsScene & removing item

Chris Gagneraud chgans at googlemail.com
Mon Jun 27 06:19:18 CEST 2016


On 26 June 2016 at 04:40, Igor Mironchik <igor.mironchik at gmail.com> wrote:
...
> My delete method is:
>
> void
> Form::deleteItems( const QList< QGraphicsItem* > & items )
> {
Snip lot of logic
> }

What about:

Form::deleteItems( const QList< QGraphicsItem* > & items )
{
  auto command *cmd = new DeleteItemsCommand();
  cmd->setItems(items)
  cmd->setModel(model)
  undoStack->push(cmd)
}

DeleteItemsCommand::redo()
{

}

>
> I do scene()->removeItem( item ); and delete item; but in the internals of
> QGraphicsScene I got two damaged pointers...
>
> What is the problem? Thank you.
>
> P.S. postDeletion() methods now is empty, like:
>
> void postDeletion()
> {
> }
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list