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. QtQuick 2.0 Canvas Context2D clipping region doesn't resize beyond original window size
Forum Updated to NodeBB v4.3 + New Features

QtQuick 2.0 Canvas Context2D clipping region doesn't resize beyond original window size

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.5k 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.
  • R Offline
    R Offline
    RickyKeith
    wrote on last edited by
    #1

    I ran into a problem with the clipping region in a Canvas not resizing properly. In the included simple example, if you size the app window up beyond twice its original width and/or height, you can see that the green rectangle is no longer clipped by the blue rectangle, but by a smaller region. It's as if the clip region can't grow beyond the original app window size.
    I'm new to Qt/QML, but I don't think I'm doing anything wrong here. In fact, I tried this in an HTML doc in Chrome, and it doesn't exhibit the problem.
    This is a roadblock for my development right now...
    Thanks for looking.

    @import QtQuick 2.0

    Canvas {
    id: canvas
    width: 200; height: 200;

    onPaint: {
        var c = canvas.getContext('2d')
        c.clearRect( 0, 0, width, height )
        // save stuff (clipping path in particular)
        c.save()
        // draw blue rectangle
        c.beginPath();
        c.fillStyle = "blue"; c.rect( 0, 0, width*.5, height*.5 ); c.fill()
        // set blue rectangle as clipping path
        c.clip();
        // draw green rectangle
        c.fillStyle = "green"; c.fillRect( 20, 20, width*.7, height*.7 );
        // restore stuff (clipping path)
        c.restore()
    }
    

    }
    @

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mitchc
      wrote on last edited by
      #2

      This has been reported here: https://bugreports.qt-project.org/browse/QTBUG-36761

      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