Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML app chrashes after user-triggered drawImage call
Forum Updated to NodeBB v4.3 + New Features

QML app chrashes after user-triggered drawImage call

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 596 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Andreykonn
    wrote on last edited by
    #1

    I have this code:

    @import QtQuick 2.1
    import QtQuick.Controls 1.0

    Rectangle {
    width: 640
    height: 600
    id: win
    Image
    {
    id: img
    source: "../../../../../Windows/winsxs/x86_setup-uxwizard-clientimages_31bf3856ad364e35_6.1.7600.16385_none_48ada01d8ff36e68/background.bmp"
    width:300
    height:300
    }
    Canvas
    {
    anchors.bottom: parent.bottom
    width:300
    height:300
    id: cnv
    onPaint: {
    var ctx = cnv.getContext('2d');
    ctx.drawImage(img, 0,0,300,300);

        }
    }
    Button {
        text: 'Do it'
        anchors.centerIn: parent
        onClicked: {
            cnv.requestPaint();
        }
    }
    

    }@

    drawImage works (though terribly slow) until you request it by requestPaint. Then it just crashes the app. Tested on Windows 7, QT 5.1. Just change Image.source to any available image file.

    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