[kde-edu]: attempt at a KPlotWidget replacement based on QGraphicsView
Jason Harris
kstars at 30doradus.org
Tue Sep 5 03:20:45 CEST 2006
Hello,
I spent the weekend trying to work out a replacement for KPlotWidget based on
QGraphicsView. It seemed like a good idea, because QGraphicsView already
encapsulates the separation of Data space and pixel space, uses a model/view
architecture, and is supposed to be fast.
Unfortunately, I am rather disappointed with the results. There's no easy way
in QGraphicsView to accomodate the axis labels and tick labels, because the
entire Widget is devoted to the View of the data; there's no way to set a
QRect for the View that is smaller than the widget itself. So I ended up
creating a QFrame containing a 3x3 grid of widgets, where the center widget
is the QGraphicsView, and the eight around the edge are to hold the axis
information. That's pretty ugly.
It also seems much slower than the old KPlotWidget. For example, when
resizing the plot, there are noticeable redraw lags. In general, it just
feels like I am using a square peg for a round hole.
It's possible that some of these shortcomings are just because I'm using the
wrong approach, but I'm ready to give up on it. If anyone else wants to try
doing something with the code I've written, I can make it available.
Let me know,
Jason
--
KStars: http://edu.kde.org/kstars
Community Forums: http://kstars.30doradus.org
More information about the kde-edu
mailing list