[Qt-interest] QGWidgetProxy: background reuse, pen width and opengl issues

David García Garzón david.garcia at upf.edu
Wed Aug 19 16:37:27 CEST 2009


We have ported our Qt4.1 based dataflow editor widget (NetworkCanvas) to 
QGraphicsView. The port is almost complete now. But we still have some issues 
and i would like someone to help us.

The dataflow modules (we call them ProcessingBoxes which are QGItems now) may 
have an embeded widget for data monitorization, control sending... Right now, 
we just place such widget on the top of the NetworkCanvas as regular child 
widget and it used to work but with the awful side effect of having the widgets 
overlap any other element of the canvas[1] and some artifacts on moving. 
Something that we want to fix by using QGWidgetProxy. 

But after trying QGWidgetProxy, we got a several issues:

1- We were not able to reuse the parent item, or whatever they have below, as 
background. By default the standard grey background is drawn. If we set 
'background-color:transparent' style to disable the standard grey background, 
we get a lot of artifacts[2]. Areas drawn with QPalette::Base (spin box 
numbers) turn into black and Areas drawn with QPalete::Window draw a black box 
on the top and a semitransparent gradient is painted on the background. Any 
idea on how to achieve background reuse or getting the artifacts away?

2- Some custom widgets like an oscilloscope which just draws a polyline, 
scales the painter to have the same coordinates than the domain (1,-1). The 
problem is that the pen width gets scaled as well when inside QGWP while as 
regular widget it doesn't. Is that a QGWP bug that they work different or am i 
missing something? 
The paintEvent method contains this:
        QPainter painter(this);
        painter.setPen(QColor(0x77,0x77,0x77,0x77));
        painter.translate(0,height()/2);
        painter.scale(width(),-height()/2);
        // axis line, gets scaled as well
        painter.drawLine(0,0,1,0);
        painter.setPen(_lineColor);
        QPolygonF line;
        for (int i=0; i<_size; i++)
            line << QPointF(float(i)/size, _data[i]);
        painter.drawPolyline(line);

3- Some of the monitoring widgets are OpenGl based[3], documentation says 
OpenGl widgets are not supported. My current workaround is to keep them as on-
top widgets if the WA_PaintOnScreen flag is set. But this still has the 
problems of overlaping any canvas drawing and moving artifacts. Is there any 
plan to support them in the future? Any alternative idea?

[1] http://clam-project.org/wiki/Image:BeforeMerge2.png
[2] http://clam-project.org/wiki/Image:QGWPBugs.png
[3] http://clam-project.org/wiki/Image:OptimizedKeySpace.png

-- 
David García Garzón
http://www.iua.upf.edu/~dgarcia
http://clam-project.org




More information about the Qt-interest-old mailing list