PDA

View Full Version : Adding QGraphicsProxyWidget items into QGraphicsScene



yagabey
19th November 2008, 13:30
Hello,

I have got several widgets which I should add into a GraphicsScene...
I found a new class in Qt4.4 "QGraphicsProxyWidget " that makes easier adding widgets into graphicsscene .
I succesfully added most of my widgets as in the embeddeddialogs example of qt; but on some of my widgets I use QGLWidget to make some drawings. At that point qt gives a warning and that widget is not shown on the screen:

QPainter::begin: A paint device can only be painted by one painter at a time

I am adding the widgets as follow:


CustomProxy *proxy = new CustomProxy(0, Qt::Window);
myDialog *dialog1=new myDialog;
proxy->setWidget(dialog1);
scene.addItem(proxy);

Should i use a different design pattern? Any idea?..

Thanks, regards..

wysota
19th November 2008, 20:31
As far as I know currently you shouldn't add GL widgets to graphicsview. You can instead add a custom widget with a GL context where you will render its content to a pixel buffer and then render the resulting pixmap as the item in graphics view.

QbelcorT
20th November 2008, 14:01
hi,
I am rendering a pixmap image using a proxy widget. Take a look at the /examples/graphicsview/pad_navigator example 'roundrectitem'.

yagabey
21st November 2008, 06:33
I think , you are right; i converted tht qglwidget to qwidget, and it worked. It would be nice if graphicsview supported qglwidgets. Anyway...