PDA

View Full Version : Qt drawable surface problems going from Qt4 to Qt5



nikha
5th August 2014, 09:55
Hello,

I'm currently trying to port a widget created in Qt4 to Qt5. The widget is using third party libraries that require a handle to a x11 drawable surface, in Qt4 it was done by the widget being a subclass to QLabel and by letting it have a QPixmap::Handle(). In Qt5 this function has been removed from QPixmap and I have been trying to find a way around this.

The only solution that I have found is to take the QWidget::winId() from the widget itself and use that as the required handle.
That works and as long as I use setAttribute( Qt::WA_PaintOnScreen, true ) on the widget, but after I do that every change in the drawing is always one step behind what it's actually supposed to be showing and it doesn't update until I redraw it the next time.

Is there some difference between using the old QPixmap::Handle() from QWidget::winId() that could cause the delayed drawing?
It seems like if I don't use setAttribute( Qt::WA_PaintOnScreen, true ), then it fights with Qt for drawing to that surface but then it is not delayed anymore. Is there something else I should do after setting this attribute to make it update correctly?

I would greatly appreciate any help I could get with this. :)

Hualet Wang
29th July 2015, 09:29
Hi, which 3rd party library did you use? I'm trying to paint using libcairo but with no luck.

anda_skoa
29th July 2015, 10:55
Maybe you can make libcairo draw into a pixel buffer and the use QImage on that buffer to draw the image into the widget?

Cheers,
_