how to manage QGraphicsScene
mkossick at gmx.de
Sun Jul 22 09:00:04 CEST 2007
On Saturday 21 July 2007, Ian Monroe wrote:
> > Option two sounds like the least work two me. Keeping the members private
> > and creating the qgraphicsscene on first access should keep both memory
> > comsumption and complexity (because you don't have to check for
> > null-pointers in the calling code) down.
> > Cheers, Max
> Well regardless of the solution there's going to be a method in the
> model (or perhaps just part of ::data) that returns the qgraphicscene,
> it could be created there. The issue with the second solution is that
> I'd have to iterate over all the items being added to the playlist and
> create this new Playlist::Item object (even for objects that aren't
> being painted).
The only problem I see with that solution is that removing tracks from the
playlist gets a bit more difficult (instead of calling QList::removeAll, you'd
have to iterate over the list yourself to find the correct track) Instead of
inserting Tracks into the playlist, you'd do something like this:
list.append( Item( track ) );
no need to iterate over the playlist. The only difference between the proposed
Playlist::Item and QPair is that the Item would be able to create the
QGraphicsScene on demand.
If I understand you correctly, you want to create the QGraphicsScenes lazily,
even for t third option. That means you'll have two lists with different
lengths, and need an additional mapping from one list to another. Sounds more
compilcated to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20070722/a402536f/attachment.pgp
More information about the Amarok-devel