Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-54135

OpenGL and QPainter with Qt:DotLine

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.6.0, 5.12.9, 5.15.0
    • GUI: OpenGL
    • None
    • Win 7, MSVC 2013 64b

      In paintGL draw eg. circle dotline out off screen then next QPainter::setPen do not change color next drawing.

      In this code rectangle is blue and line is red.
      But expected rectangle and line to blue.
      If circle is drawed on screen or if change Qt::DotLine to solid line everything is OK.

      void MapView::paintGL()
      {
        QPainter p(this);
      
      p.beginNativePainting();
      
        glViewport(0, 0, width(), height());
        glClearDepthf(1);
        glClearColor(0,0,0,1);
        glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        
        glDisable(GL_DEPTH_TEST);
      
        p.endNativePainting();  
      
        p.setPen(QPen(Qt::blue, 2));
        p.drawLine(15, 15, 1000, 1000);
      
        p.setPen(QPen(Qt::red, 1, Qt::DotLine));
        p.drawEllipse(-50, -50, 10, 10);
      
        p.setPen(QPen(Qt::blue, 4));
        p.drawRect(15, 15, 1000, 1000);
      }
      

      In code.zip is modified example bubble overpainting. Try resize screen to view bug.

        1. code.zip
          9 kB
        2. qtbug54135.zip
          18 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            sletta Gunnar Sletta
            pavelmraz Pavel Mraz
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes