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

Konstantin Tokarev annulen at yandex.ru
Tue Apr 12 19:16:27 CEST 2011



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)

-- 
Regards,
Konstantin



More information about the Qt-interest-old mailing list