Advertisement
Guest User

Untitled

a guest
Apr 4th, 2020
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 3.32 KB | None | 0 0
  1. import QtQuick 2.13
  2. import QtQuick.Window 2.13
  3. import QtQuick.Controls 2.13
  4.  
  5. Item {
  6.     property int page: 1
  7.  
  8.     Text {
  9.         id: text
  10.         text: ""
  11.         anchors.horizontalCenter: parent.horizontalCenter
  12.         font.family: "Courier New"
  13.         color: "#f5edba"
  14.         font.pixelSize: 15
  15.     }
  16.  
  17.     Image {
  18.         id: img
  19.         sourceSize.width: 460
  20.         sourceSize.height: 460
  21.         anchors.top: text.bottom
  22.         anchors.topMargin: 10
  23.         anchors.horizontalCenter: parent.horizontalCenter
  24.         anchors.verticalCenter: parent.verticalCenter
  25.         states:
  26.         [
  27.             State {
  28.                 name: "1"; when: page == 1;
  29.                 PropertyChanges {
  30.                     target: img;
  31.                     source: "images/1.jpg";
  32.                     anchors.topMargin: 10
  33.                 }
  34.             },
  35.             State {
  36.                 name: "2"; when: page == 2;
  37.                 PropertyChanges {
  38.                     target: img;
  39.                     source: "images/2.jpg";
  40.                     anchors.topMargin: 10
  41.                 }
  42.             },
  43.             State {
  44.                 name: "3"; when: page == 3;
  45.                 PropertyChanges {
  46.                     target: img;
  47.                     source: "images/3.jpg";
  48.                 }
  49.             },
  50.             State {
  51.                 name: "4"; when: page == 4;
  52.                 PropertyChanges {
  53.                     target: img;
  54.                     source: "images/4.jpg";
  55.                 }
  56.             },
  57.             State {
  58.                 name: "5"; when: page == 5;
  59.                 PropertyChanges {
  60.                     target: img;
  61.                     source: "images/5.jpg";
  62.                 }
  63.             },
  64.             State {
  65.                 name: "6"; when: page == 6;
  66.                 PropertyChanges {
  67.                     target: img;
  68.                     source: "images/6.jpg";
  69.                 }
  70.             }
  71.         ]
  72.     }
  73.  
  74.     Button {
  75.         id:leftButton
  76.         font.pixelSize: 20
  77.         text: "<="
  78.         font.family: "Courier New"
  79.         background: Rectangle {
  80.             color: "#f5edba"
  81.             border.width: 1
  82.             radius: 4
  83.         }
  84.         anchors.verticalCenter: parent.verticalCenter
  85.         anchors.right: img.left
  86.         anchors.rightMargin: 10
  87.         onClicked: {
  88.             if ((page - 1) > 0) page = page - 1
  89.         }
  90.     }
  91.  
  92.     Button {
  93.         id:rightButton
  94.         font.pixelSize: 20
  95.         text: "=>"
  96.         font.family: "Courier New"
  97.         background: Rectangle {
  98.             color: "#f5edba"
  99.             border.width: 1
  100.             radius: 4
  101.         }
  102.         anchors.verticalCenter: parent.verticalCenter
  103.         anchors.left: img.right
  104.         anchors.leftMargin: 10
  105.         onClicked: {
  106.             if (page + 1 < 7) page = page + 1
  107.         }
  108.     }
  109.  
  110.     Button {
  111.         id: home
  112.         text: "На главную"
  113.         font.family: "Courier New"
  114.         font.pixelSize: 20
  115.         background: Rectangle {
  116.             color: "#f5edba"
  117.             border.width: 1
  118.             radius: 4
  119.         }
  120.         anchors.bottom: parent.bottom
  121.         anchors.horizontalCenter: parent.horizontalCenter
  122.         anchors.bottomMargin: 10
  123.         onClicked: {
  124.             window.status = 0
  125.         }
  126.     }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement