Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it expected I have to update the parent widget myself with using QOpenGLWidget?
Forum Updated to NodeBB v4.3 + New Features

Is it expected I have to update the parent widget myself with using QOpenGLWidget?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 347 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NightShadeI
    wrote on last edited by
    #1

    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 calling move(...) on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug?

    S N 2 Replies Last reply
    0
    • N NightShadeI

      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 calling move(...) on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug?

      S Offline
      S Offline
      SamiV123
      wrote on last edited by SamiV123
      #2

      @NightShadeI

      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...

      N 1 Reply Last reply
      0
      • S SamiV123

        @NightShadeI

        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...

        N Offline
        N Offline
        NightShadeI
        wrote on last edited by NightShadeI
        #3

        @SamiV123

        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.

        1 Reply Last reply
        0
        • N NightShadeI

          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 calling move(...) on QOpenGLWidget. Is this expected? should I have to be doing this - or should I be raising some bug?

          N Offline
          N Offline
          NightShadeI
          wrote on last edited by
          #4

          @NightShadeI bump on this, any thoughts by anyone?

          KenAppleby 0K 1 Reply Last reply
          0
          • N NightShadeI

            @NightShadeI bump on this, any thoughts by anyone?

            KenAppleby 0K Offline
            KenAppleby 0K Offline
            KenAppleby 0
            wrote on last edited by
            #5

            @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

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved