Advertisement
Guest User

Untitled

a guest
Sep 18th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import QtQuick 2.9
  2. import QtQuick.Controls 2.2
  3. import QtQuick.Layouts 1.3
  4.  
  5. ApplicationWindow {
  6.     id: root
  7.  
  8.     visible: true
  9.     width: 640
  10.     height: 480
  11.  
  12.     property bool toggle: true
  13.  
  14.     GridLayout {
  15.         anchors.fill: parent
  16.         columns: 4
  17.         Rectangle {
  18.             color: "orange"
  19.             Layout.fillWidth: true
  20.             Layout.fillHeight: true
  21.             Layout.column: root.toggle ? 0 : 3
  22.         }
  23.         Rectangle {
  24.             color: "green"
  25.             Layout.fillWidth: true
  26.             Layout.fillHeight: true
  27.             Layout.column: root.toggle ? 1 : 2
  28.         }
  29.     }
  30.     Button {
  31.         anchors.centerIn: parent
  32.         text: "Switch sides"
  33.         onClicked: root.toggle = !root.toggle
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement