Is it expected I have to update the parent widget myself with using QOpenGLWidget?
-
Hi, ive been working on making my own QT application with its own subwindows and one of the behaviours I added was the ability to drag these windows around.
I notice I was getting line artifacts appearing after moving the window as a result of a drag (using
this->move(...)
) , these appeared where the window was moved from. Whats more, this only appeared on some monitors.I was eventually able to solve it by calling
parentWidget()->update()
after callingmove(...)
on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug? -
Hi, ive been working on making my own QT application with its own subwindows and one of the behaviours I added was the ability to drag these windows around.
I notice I was getting line artifacts appearing after moving the window as a result of a drag (using
this->move(...)
) , these appeared where the window was moved from. Whats more, this only appeared on some monitors.I was eventually able to solve it by calling
parentWidget()->update()
after callingmove(...)
on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug?What kind of artifact?
I have a system where I move a QWidget (that contains a QWindow that renders with OpenGL) around and randomly sometimes the rendering barfs and the pixels aren't updated. Only happens on Windows though and I've been looking for a workaround for this...
-
What kind of artifact?
I have a system where I move a QWidget (that contains a QWindow that renders with OpenGL) around and randomly sometimes the rendering barfs and the pixels aren't updated. Only happens on Windows though and I've been looking for a workaround for this...
In my case I have 1 parent widget, and 3 GL widgets inside. I move around any of these 3 GL widgets as so
QPoint theOffset{}; void mousePressEvent(QMouseEvent* aMouseEvent) override { this->raise(); theOffset = aMouseEvent->pos(); } void mouseMoveEvent(QMouseEvent* aMouseEvent) override { if(aMouseEvent->buttons() & Qt::LeftButton) { const QPoint myNewOffset = mapToParent(aMouseEvent->pos()); const int myNewX = std::clamp(myNewOffset.x(), 0, parentWidget()->width()); const int myNewY = std::clamp(myNewOffset.y(), 0, parentWidget()->height()); const QPoint myNewPos = QPoint{myNewX, myNewY} - theOffset; this->move(myNewPos); this->parentWidget()->update(); } }
If I do not call
this->parentWidget()->update()
then I get weird lines (also on windows OS) appear in the root parent QWidget. These lines only vanish when a widget is dragged back over them. -
Hi, ive been working on making my own QT application with its own subwindows and one of the behaviours I added was the ability to drag these windows around.
I notice I was getting line artifacts appearing after moving the window as a result of a drag (using
this->move(...)
) , these appeared where the window was moved from. Whats more, this only appeared on some monitors.I was eventually able to solve it by calling
parentWidget()->update()
after callingmove(...)
on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug?@NightShadeI bump on this, any thoughts by anyone?
-
@NightShadeI bump on this, any thoughts by anyone?
@NightShadeI Possibly related is that, on Windows, QtCreator's model editor used to have the same defect until the recent upgrade to QtCreator 12. It would leave behind graphics artefacts as you moved elements around. There may be clues in the QtCreator sources.
By model editor I mean what you get when you "Add new..." => Modeling => Model