PDA

View Full Version : QRubberBand Overdrawn?



qtoptus
2nd March 2015, 06:16
Hello,

I'm using QRubberBand to draw a moving resize handle like the QSplitter's, it's working fine until it's dragged over a custom rendering widget (using OpenGL), it looks darker like it's overdrawn and while moving it shows trails behind it. This only happens on the portion overlapping with the OpenGL widget. Any idea what possible causes for this?

Thanks.

wysota
2nd March 2015, 06:57
QGLWidget should not be composed with other widgets (especially on Windows). To make it work properly you should switch to Qt5 and use the latest additions to OpenGL rendering in Qt.

qtoptus
3rd March 2015, 06:26
I'm not using any Qt OpenGL Widgets, I create my own OpenGL-enabled widget, which also supports Direct3D.

wysota
3rd March 2015, 08:13
Well then you are on your own as far as composting is concerned. You have to find a proper way to overlay the rubber band.

qtoptus
3rd March 2015, 17:08
So if I use the Qt OpenGL widgets, the rubber band would not suffer from this problem?

Added after 1 9 minutes:

I've come across similar threads and it seems there're no solution...

wysota
3rd March 2015, 20:31
So if I use the Qt OpenGL widgets, the rubber band would not suffer from this problem?

If you use the ones from Qt 5.3+ then you should be fine.

qtoptus
4th March 2015, 05:05
Thanks for help.

qtoptus
7th March 2015, 03:39
I noticed the same problem occurs with QSplitter. So if I have a quad split views, it only happens when moving the splitter handle that separates two 2 views on each sides, not the splitter between two views. Also the color appears darker than when it's on other widgets.

Kryzon
7th March 2015, 22:24
I'm not using any Qt OpenGL Widgets, I create my own OpenGL-enabled widget, which also supports Direct3D.
Could you elaborate on how did you implement your own D3D rendered widget with Qt? (It's something I'm interested.)

qtoptus
8th March 2015, 18:46
First I create a class derived from QWidget with following settings in the constructor:

setAutoFillBackground(false);
setAttribute(Qt::WA_PaintOnScreen, true);
setAttribute(Qt::WA_NativeWindow, true);

Then I pass the winId() of this widget to Direct3D setup code. You have to cast the returned winId() to HWND

You also need to override the D3D widget's paintEngine() to return NULL

And paintEvent(QPaintEvent *ev) to call D3D rendering commands between BeginScene/EndScene pairs...as usual

Hope this helps.