[Development] Behaviour change of opacity property in QtQuick 2.0

Nils Jeisecke njeisecke at saltation.de
Wed Jul 18 13:47:36 CEST 2012


Hi,

In QtQuick 1 an element with opacity == 0 is treated as invisible
(e.g. it won't see mouse events).
This has changed in QtQuick 2.0 which breaks existing code that
assumes that opacity == 0 means !visible.

This example illustrates the change. A mouse click will print:
QtQuick 1.1: "CLICKED A"
QtQuick 2.0: "CLICKED B"

A workaround is to set "visible: opacity > 0"

Is this change intentional?

---

//import QtQuick 2.0
import QtQuick 1.1

Rectangle {
  width: 360
  height: 360
  MouseArea {
    anchors.fill: parent
    onClicked: console.log("CLICKED A")
  }

  Rectangle {
    anchors.fill: parent
    opacity: 0
    MouseArea {
      anchors.fill: parent
      onClicked: console.log("CLICKED B")
    }
  }
}

---



More information about the Development mailing list