FANDOM


QML Repeater


Repeater {
 id: kk
 model: 8; // just define the number you want, can be a variable too
 
 delegate: Rectangle {
   width: parent.width/4
   height: parent.width/4
   color: "lightgray";
   border { width: 3; color: "brown" }
   radius: 7;
   property string fajta: "akarmi"
 
   MouseArea{
       hoverEnabled: true
       anchors.fill: parent;
       onEntered: {
           text2.text=index+1; 
           text1.color = "White"; 
           parent.color = csatoloid.getReserved(index+1); 
           width = 120; 
           height = 120;
           text1.font.pixelSize = parent.width/3; 
        }
       onExited:  {
          color = "lightgray";
          text1.color = "black"; 
          width=100;
          height=100;  
          text1.font.pixelSize = parent.width/4; 
          }
       onClicked:  {
          csatoloid.actAsztal=(index+1).toString(); 
          item1.visible=false;  
          item2.visible=true;
          text4.text=csatoloid.actAsztal.toString()+". asztal"
          text5.text=csatoloid.actAsztal.toString()+". asztal rendeli:"
          }
               }
               Text {
                  id: text1
                  anchors.verticalCenter: parent.verticalCenter
                  anchors.horizontalCenter: parent.horizontalCenter
                  z: 0
                  color: "black"
                  //font.pointSize: parent.width/7
                  text: parent.fajta
                  font.pixelSize: parent.width/4
                  Behavior on font.pixelSize {
                  NumberAnimation { duration: 200 }
                  }
              }
            }
          }
}
 
Button {
   id: bx
   x: 142
   y: 153
   text: qsTr("Beküld")
   onClicked: {
       kk.itemAt(2).fajta="Helló1"
       kk.itemAt(4).fajta="Helló2"
       kk.itemAt(5).fajta="Helló3"
       }
}