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

Using QML image alpha for ignoring mouse clicks

    XMLWordPrintable

    Details

      Description

      Hi,

      I think it would be nice to have a property in QML "Image" elements, or maybe in "MouseRegion", that tells the QML not to accept mouse events over pixels that have an alpha under some threshold.

      Or maybe did I miss a simple way to do that?

      Maybe something like an interface on the pixmap property of images would do (see example below)? Or maybe is it already possible but I missed that?

      Image
      {
      	id: quarter_moon_shaped_button
      	source:"QuarterMoonShapedButton.png"
      	         MouseRegion
      		 { 
      			id: mouseRegion2; anchors.fill: parent;
      			onPressed:
      			{
      				if(quarter_moon_shaped_button.pixmap.alpha(mouse.x,mouse.y)<0.4) mouse.accepted=false;
      			}
      		 }
      }
      

      B)

      Image
      {
      	id: quarter_moon_shaped_button
      	source:"QuarterMoonShapedButton.png"
      	         MouseRegion
      		 { 
      			id: mouseRegion2; anchors.fill: parent;
      			onPressed:
      			{
      				if(quarter_moon_shaped_button.alpha(mouse.x,mouse.y)<0.4) mouse.accepted=false;
      			}
      		 }
      }
      

        Attachments

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

          Activity

            People

            Assignee:
            martjone Martin Jones (closed Nokia identity) (Inactive)
            Reporter:
            dominic.genest Dominic Genest
            Votes:
            6 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes