[Qt-interest] QGraphicsScene and mouse events

Mahendra G.R mahendra at mahendragr.com
Fri Nov 26 16:29:01 CET 2010


oops, sorry Oliver, actually its not one item in the end, its arbitrary,
anyway i figured it out, thanks for your reply.


Regards,

On Fri, Nov 26, 2010 at 4:20 PM, <Oliver.Knoll at comit.ch> wrote:

> On 2010-11-26 Mahendra Mahendra G.R wrote:
>
> > Hi Oliver,
> >
> > I just gave the full code so that someone can run and see what the
> problem is
> > because i didnt know how to explain it, yea i checked the diagram scene
> example
> > but its not very clear to me.  Regarding my problem, i want to know if
> its possible
> > to delete all the items and just keep one item which was added in the
> end!, i looked
> > in for clear() method and items() method, but not sure how to do it.
>
> That is the second most important rule of mailing lists: DON'T write people
> in private, unless the message is really meant to be private - yours is
> clearly not!
>
> Again, my point is the same: if you don't know how to explain the problem,
> how do you expect ANYONE to understand what you mean?
>
> So to your question: yes, sure it is possible to delete all but the last
> one added. Just keep track of the item which was added last somehow, e.g. in
> a member variable
>
> QGraphicsItem *m_lastAddedItem;
>
> Then delete all items but this one. Or keep a list of all items, and append
> new items to the end. Then delete the first n - 1 items. There are probably
> dozens of other approaches, but this is *basic* software engineering.
>
> Cheers, Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
http://www.mahendragr.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101126/f3f47fd8/attachment.html 


More information about the Qt-interest-old mailing list