Advertisement
Guest User

FirstPage.qml

a guest
Mar 20th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 5.64 KB | None | 0 0
  1. import QtQuick 2.0
  2. import QtQuick.Controls 2.5
  3.  
  4. Item {
  5.     Rectangle{
  6.         width: 500
  7.         height: 380
  8.  
  9.         Rectangle{
  10.             width: 330
  11.             height: 40
  12.  
  13.             Image {
  14.                 source: "qrc:/../../Desktop/header1.png"
  15.                 y: 10
  16.                 x: 10
  17.                 z: 2
  18.             }
  19.  
  20.             Rectangle{
  21.                 color: "#e9e9e8"
  22.                 width: 230
  23.                 height: 37
  24.                 x: 50
  25.                 y: 12
  26.                 z: 1
  27.                 radius: 15
  28.  
  29.                 Button {
  30.                     x: 22
  31.  
  32.                     background: Rectangle {
  33.                                 color: "transparent"
  34.                             }
  35.                     contentItem: Text {
  36.                         text: qsTr("My Lists")
  37.                         font.pointSize: 15
  38.                     }
  39.                 }
  40.  
  41.                 Button{
  42.                     id: buttonCreate
  43.                     x: 110
  44.                     y:  5
  45.  
  46.                     background: Rectangle {
  47.                                 id: rectangle1
  48.                                 color: "transparent"
  49.                             }
  50.                     contentItem: Text {
  51.                         id: textContent
  52.                         text: qsTr("Create a new List")
  53.                         font.pointSize: 10
  54.                         color: "red"
  55.                         font.underline: true
  56.                     }
  57.  
  58.                     states:[
  59.                         State {
  60.                             name: "Hovering"
  61.                             PropertyChanges {
  62.                                 target: textContent
  63.                                 color: "white"
  64.                                 font.underline: false
  65.                             }
  66.                             PropertyChanges {
  67.                                 target: rectangle1
  68.                                 color: "red"
  69.                             }
  70.                         }]
  71.  
  72.                     MouseArea{
  73.                         hoverEnabled: true
  74.                         anchors.fill: buttonCreate
  75.                         onEntered: { buttonCreate.state='Hovering'}
  76.                         onExited: { buttonCreate.state=''}
  77.                         onClicked:{
  78.                             myStackView.push(createNewListPage)
  79.                         }
  80.                     }
  81.  
  82.                 }
  83.             }
  84.  
  85.         }
  86.  
  87.  
  88.  
  89.         ListView{
  90.             id: lists
  91.             width: 150
  92.             height: childrenRect.height
  93.             x: 15
  94.             y: 70
  95.  
  96.             model: controller.lists
  97.  
  98.             delegate: Row{
  99.                 width: 150
  100.                 height: 25
  101.                 spacing: 5
  102.  
  103.                 Rectangle{
  104.                     width: {
  105.                         if(uncompleted < 3){return 3;}
  106.                         else if(uncompleted < 6){return 6;}
  107.                         else {return 10;}
  108.                     }
  109.                     height: {
  110.                         if(uncompleted < 3){return 3;}
  111.                         else if(uncompleted < 6){return 6;}
  112.                         else {return 10;}
  113.                     }
  114.                     radius: 10
  115.                     color: "#494949"
  116.                     anchors.verticalCenter: parent.verticalCenter
  117.                 }
  118.                 Button {
  119.                     id:button1
  120.                     height: 23
  121.  
  122.                     contentItem: Text {
  123.                         id: textTask
  124.                         text: name
  125.                         font.underline: true
  126.                         color: "blue"
  127.                         font.bold: true
  128.                         font.pointSize: 10
  129.                         height: 20
  130.                         anchors.verticalCenter: parent.verticalCenter
  131.                         anchors.left: parent.left
  132.                     }
  133.  
  134.                     background: Rectangle {
  135.                         id: rectangle
  136.                         color: "transparent"
  137.                     }
  138.                     states:[
  139.                         State {
  140.                             name: "Hovering"
  141.                             PropertyChanges {
  142.                                 target: textTask
  143.                                 color: "white"
  144.                                 font.bold: true
  145.                                 font.underline: false
  146.                             }
  147.                             PropertyChanges {
  148.                                 target: rectangle
  149.                                 color: "blue"
  150.                             }
  151.                         }]
  152.  
  153.                     MouseArea{
  154.                         hoverEnabled: true
  155.                         anchors.fill: button1
  156.                         onEntered: { button1.state='Hovering'}
  157.                         onExited: { button1.state=''}
  158.                     }
  159.                 }
  160.                 Text{
  161.                     font.pointSize: 8
  162.                     text: {
  163.                         if(uncompleted == 0)return "";
  164.                         return "- " + uncompleted + " left";
  165.                     }
  166.                     color: "#494949"
  167.                     anchors.verticalCenter: parent.verticalCenter
  168.                 }
  169.             }
  170.         }
  171.  
  172.         Row {
  173.             anchors.top: lists.bottom
  174.             x: 15
  175.             spacing: 5
  176.             anchors.topMargin: 8
  177.  
  178.             Text{
  179.                 text: {
  180.                     text: qsTr("Completed lists: ")
  181.                 }
  182.             }
  183.  
  184.             Text {
  185.                 text: qsTr("")
  186.             }
  187.         }
  188.  
  189.  
  190.  
  191.     }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement