[Qt-interest] newbe alert - I am trying to convert plotting from C# to QT4

Constantin Makshin cmakshin at gmail.com
Tue Apr 12 19:21:45 CEST 2011


Yes, but my solution looks somewhat better because with QGraphics* it's much easier to implement zooming, scrolling and other operations that may be very convenient when viewing plots.

On Tuesday 12 April 2011 21:16:27 Konstantin Tokarev wrote:
> 
> 12.04.2011, 20:59, "Constantin Makshin" <cmakshin at gmail.com>:
> > My idea:
> > 1) create Plot class derived from QObject — as the name suggests, it'll represent your plot;
> > 2) add a QGraphicsScene object to the class — this object will contain data (QGraphicsItem-s) Qt will use to draw the plot;
> > 3) add update() or similar slot that will update (update/recreate QGraphicsItem-s) the plot when called, i.e. it'll act as your Panel_paint() function. In the end of this function don't forget to call update() function of the object created in (2) to schedule plot repainting;
> > 4) add other members as necessary;
> > 5) create a QGraphicsView widget — it'll be used to show the plot, i.e. it'll act as your Panel class. Set the object created in (2) as the view's scene.
> 
> Or you can create PlotWidget class derived from QWidget and draw on it with QPainter in paintEvent (without QGraphicsView and QGraphicsScene)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110412/5afa08d4/attachment.bin 


More information about the Qt-interest-old mailing list