how to manage QGraphicsScene
Ian Monroe
ian at monroe.nu
Fri Jul 20 23:19:02 CEST 2007
So currently PlaylistNS::Model just has a Meta::TrackList of tracks,
which it inserts, removes etc. directly. This is neat because when you
drag stuff from the collection browser it can insert stuff directly
into the TrackList at essentially no cost.
But I'm needing to add some playlist specific data to the Tracks or
otherwise associate the data with them. The issue is that currently
the Delegate creates QGraphicScene's, adds shit to them, paints them
and then destroys the QGraphicsScene. This is a bit wasteful and is
also why I think editing the text currently doesn't work even when I
set it to on (hopefully it doesn't rely on a QGraphicsView...).
So I could...
*Subclass Meta::Track, make a PlaylistNS::Item, with a new ->scene()
method that makes a new scene if there isn't one already or just
returns the existing one. But I don't think I could morph a bunch of
Meta::TrackPtr's into this new object (unless we start using Ruby).
*Have PlaylistNS::Item not derive from anything, just have it with a
Meta::TrackPtr data member and a QGraphicsScene member. Then keep a
list of this.
*Have a new specialized list type which keeps in sync two separate
QLists of QGraphicsScenes and Meta::TrackPtr's.
I'm leaning towards the last solution, but I was wondering if anyone
had another idea.
Ian
More information about the Amarok-devel
mailing list