PDA

View Full Version : QGraphicsView & QwtScaleWidget



fruzzo
22nd September 2011, 14:55
Hi,
I've implemented something like s gantt through a QGraphicsView/QGraphicsScene but now I want to insert under the QGraphicsView a time scale using a QwtScaleWidget, draw data and grid inside the scene according to this scale...How can I reach this task? Some tutorials/examples?

pkj
28th September 2011, 18:50
Subclass QwtScaleDraw class, override label function. Depending on some base time(1970-01-01 or something) send time axis values as seconds to this date. Then have this class as the scaledraw in your subclassed qwtscalewidget. Meanwhile in the label function, return qstring depending upon value sent. For a more detailed scale axes, you have to implement QwtScaleEngine. But for specific purposes, the above mentioned trick works. Search the forum qwtscaledraw, there are many threads.