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

Qml Canvas crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.2.1
    • 5.1.1
    • Microsoft Windows 7 (6.1) 64-bit Service Pack 1 (Build 7601)
      Intel Core i7 2600K
      NVIDIA GeForce GTX 570
      Qt 5.1.1
      QtCreator 2.8.1
    • 9ad9615d0003c9fb84255152f0cbb473ee2a7a70

    Description

      I want to create my own painting item but I have some problems.

      • The first variant is good buh the line has many angles when I move mouse quickly.
      • The second is "black screen" error:

        ARB::createContext: wglCreateContextAttribsARB() failed (GL error code: 0x502) for format: QSurfaceFormat(version 4.4, options QFlags(0x4) , depthBufferSize 24 , redBufferSize 8 , greenBufferSize 8 , blueBufferSize 8 , alphaBufferSize 8 , stencilBufferSize 8 , samples 0 , swapBehavior 2 , profile 0 ) , shared context: 0x20000 ()
        GDI::createContext: wglShareLists() failed. (Требуемый ресурс занят.) The requested resource is busy.

        {qoute}

        Is it ok???

      • The third is good too but I think it has more angles than first...

      Next variants are more interesting.

      • The fourth has terrible image quality and it has very big lag after few seconds. Is it ok???
      • The fifth causes a crash (sometimes): The widget blinks firsts seconds (black/white) than there is a vary big lag & crash.
      • The sixth is the same like 4th.

      I want to use 5th or 2nd variant with renderStrategy: Canvas.Threaded
      Any ideas? Or there is a more good variant how to do this?

      main.qml
      import QtQuick 2.0
      
      Canvas {
          id: canvas
      
          property int windowWidth: 1000
      
          width: windowWidth
          height: windowWidth
      
          property int mx: 0
          property int my: 0
      
          antialiasing: true
          smooth: true
      
          contextType: '2d'
      
          canvasSize: Qt.size(windowWidth, windowWidth)
          canvasWindow: Qt.rect(0, 0, windowWidth, windowWidth)
          tileSize: Qt.size(5, 5)
      
          //// [1]
          //renderTarget: Canvas.FramebufferObject
          //renderStrategy: Canvas.Cooperative
      
          //// [2]
          //renderTarget: Canvas.FramebufferObject
          //renderStrategy: Canvas.Threaded
      
          //// [3]
          //renderTarget: Canvas.FramebufferObject
          //renderStrategy: Canvas.Immediate
      
          //// [4]
          //renderTarget: Canvas.Image
          //renderStrategy: Canvas.Cooperative
      
          //// [5]
          renderTarget: Canvas.Image
          renderStrategy: Canvas.Threaded
      
          //// [6]
          //renderTarget: Canvas.Image
          //renderStrategy: Canvas.Immediate
      
          MouseArea {
              anchors.fill: parent
      
              property alias ctx: canvas.context
      
              onPositionChanged: {
                  if (pressed) {
                      ctx.strokeStyle = Qt.darker("#b40000", 1.4)
                      ctx.fillStyle = "#b40000"
                      ctx.lineWidth = 3
                      ctx.lineTo(mouse.x, mouse.y)
                      canvas.markDirty(Qt.rect(mouse.x, mouse.y, 1, 1))
      
                      ctx.stroke()
                  }
              }
          }
      }
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sletta Gunnar Sletta
            zvava Alexander
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes