Advertisement
Guest User

main.qml

a guest
Jan 18th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.11 KB | None | 0 0
  1. import QtQuick 2.4
  2. import QtQuick.Controls 1.3
  3. import QtQuick.Controls.Styles 1.2
  4. import QtQuick.Window 2.2
  5. import QtQuick.Dialogs 1.2
  6.  
  7. import "QMLs"
  8.  
  9. ApplicationWindow {
  10.     id: mainWindow
  11.     objectName: "mainWindow"
  12.     title: qsTr("Hello World")
  13.     width: 290
  14.     height: 420
  15.     visible: true
  16.  
  17.     Button {
  18.         id: btnRequest
  19.         objectName: "btnRequest"
  20.         width: mainWindow.width - 10
  21.         height: 40
  22.         x: 5
  23.         y: mainWindow.height - height - 5
  24.         anchors.horizontalCenter: mainWindow.width / 2
  25.         style: ButtonStyle {
  26.             background: FuncMenuButtonB {}
  27.             label: ButtonLabel { text: "Список друзей, пожалуйста" }
  28.         }
  29.         onClicked: backend.makeRequest(140861342)
  30.     }
  31.  
  32.     ListView {
  33.         function clear() {
  34.             lvList.model.clear()
  35.         }
  36.         function append(newElement) {
  37.             lvList.model.append(newElement)
  38.         }
  39.         id: lvList
  40.         objectName: "lvList"
  41.         anchors.margins: 5
  42.         width: parent.width
  43.         height: mainWindow.height - btnRequest.height - 5
  44.         clip: true
  45.         spacing: 8
  46.         model: ListModel {}
  47.         delegate: Rectangle {
  48.                     width: lvList.width
  49.                     height: lvList.height / 6
  50.                     color: "#00AAAA"
  51.                     Image {
  52.                         id: lvImage
  53.                         objectName: "lvImage"
  54.                         anchors.margins: 3
  55.                         width: height
  56.                         height: parent.height
  57.                         source: userAva
  58.                     }
  59.                     MouseArea {
  60.                         anchors.fill: parent
  61.                         onClicked: console.log("ListView el#" + index + " clicked!")
  62.                     }
  63.                     Text {
  64.                         id: lvLabel
  65.                         objectName: "lvLabel"
  66.                         x: lvImage.height
  67.                         anchors.centerIn: parent
  68.                         text: userName
  69.                     }
  70.                 }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement