title: QML condition logic for updating a property
body: <p>I am searching for a logic, so that an Image source property is changed depending on some different conditions.</p>
  
  <p>I have created a small example with three conditions and three requirements build by those conditions.</p>
  
  <p>If a requirement is active I want to see its picture in the Image area.
  If a requirement is not active I do not want to see its image in the image area.
  If two requirements would be active at the same time, it is ok to see just one of them.</p>
  
  <p>I have problems with the code, because in case one requirement gets inactive and another gets active at the same time, the last requirement will control the content. But I want to have a higher priority on showing an image than not showing an image.</p>
  
  <p>Is there any frequent way how to solve this?</p>
  
  <p>I have the following code:</p>
  
  <p>main.qml:</p>
  
  <pre><code>import QtQuick 2.7
  import QtQuick.Controls 2.0
  import QtQuick.Layouts 1.0
  
  ApplicationWindow {
      visible: true
      width: 640
      height: 480
      title: qsTr("Hello World")
  
      property bool condition1: false
      property bool condition2: false
      property bool condition3: false
  
      Image{
          id: image
          anchors.top: parent.top
          anchors.horizontalCenter: parent.horizontalCenter
          width: 120
          height: 120
          source: ""
      }
  
      Row {
          anchors.top: image.bottom
          anchors.horizontalCenter: parent.horizontalCenter
  
          Button {
              id: button1
              text: "Condition1 = " + condition1
              onClicked: condition1 = !condition1
          }
          Button {
              id: button2
              text: "Condition2 = " + condition2
              onClicked: condition2 = !condition2
          }
          Button {
              id: button3
              text: "Condition3 = " + condition3
              onClicked: condition3 = !condition3
          }
      }
  
      StateObserver{
          condition: condition1 &amp;&amp; condition2 &amp;&amp; condition3
          bitmap: "Images/1.png"
          target: image
      }
      StateObserver{
          condition: !condition1 &amp;&amp; condition2 &amp;&amp; condition3
          bitmap: "Images/2.png"
          target: image
      }
      StateObserver{
          condition: !condition1 &amp;&amp; !condition2 &amp;&amp; condition3
          bitmap: "Images/3.png"
          target: image
      }
  }
  </code></pre>
  
  <p>StateObserver.qml</p>
  
  <pre><code>import QtQuick 2.0
  
  Item {
  
      property bool condition
  
      property string bitmap
  
      property var target
  
      onConditionChanged: {
          if (condition){
          target.source = bitmap
          }
          else {
              target.source = ""
          }
  
          console.log("Change bitmap: " + bitmap)
      }
  }
  </code></pre>