PDA

View Full Version : QWidget item in QGraphicsScene



IUnknown
27th October 2006, 10:51
Can I use my widgets to show in QGraphicsScene? Thank you very much.:confused:

wysota
27th October 2006, 10:56
Not directly. You might mimic the looks, but not the behaviour. Why do you want to have widgets there?

IUnknown
27th October 2006, 12:07
I am going to model the chemical processes. And I am going to plot function using Qwt. These plots must place with other primitives on QGraphicsScene.

wysota
27th October 2006, 12:11
Qwt is basically tightly coupled with widgets. You can create a plot as a widget, show it on the screen, grab its contents using QWidget::grabWidget(), hide the widget and use the pixmap created to render it onto a graphics item. It will be quite slow though, so if you want to have something close to real-time updates, I suggest you implement your own plotting as a graphics item directly, especially that you'll be able to use many features it has and which are not handled by Qwt (like the level of detail).

Uwe
4th November 2006, 00:05
Curves, spectrograms, markers .. are QwtPlotItems - no widgets. I´m pretty sure that it wouldn't be very difficult to embedd them in a QGraphicsItem.

But maybe it´s enough to implement the chemical primitives as QwtPlotItems, painting them on the QwtPlot canvas. I wouldn´t expect much difference in writing the painting code for a new type of QwtPlotItem compared to writing it for a QGraphicsItem.

QGV and Qwt are both frameworks for graphic primitives. But without a deeper knowledge about the requirements of an application it is hard to recommend which one should be used.

Uwe

@wysota: sometimes not answering is the better idea.