Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.6
- import QtQuick.Window 2.2
- import QtQuick.Layouts 1.1
- import QtQuick.Controls 1.3
- Window {
- visible: true
- width: 640
- height: 480
- title: qsTr("List food")
- color: "lightgrey"
- ListView{
- model: listmod
- id: listId
- property int selected_id: -1
- width: parent.width
- height: parent.height - 100
- delegate: Rectangle{
- width: parent.width
- anchors.left: parent.left
- height: 100
- clip: true
- Rectangle{
- anchors.fill: parent
- anchors.margins: 5
- color: (listId.selected_id == index) ? "red" : ((index % 2 == 0) ? "lightsteelblue" : "lightskyblue")
- //border.color: (listId.selected_id == index) ? "black" : ((index % 2 == 0) ? "lightsteelblue" : "lightskyblue")
- ColumnLayout{
- anchors.leftMargin: 20
- Label{
- text: name
- }
- Label{
- text: "Kalória: "+calories+ " kcal"
- }
- Label{
- text: "Szénhidrát: "+carb+ " g"
- }
- Label{
- text: "Fehérje: "+protein+ " g"
- }
- Label{
- text: "Zsír: "+fat+ " g"
- }
- }
- }
- MouseArea{
- width: parent.width
- height: parent.height
- onClicked: {
- seltextid.text = name + "\n" + "Kalória: "+calories+ " kcal" + "\n" + "Szénhidrát: "+carb+ " g" + "\n" + "Fehérje: "+protein+ " g" + "\n" + "Zsír: "+fat+ " g" +"\n"
- listId.selected_id = index
- }
- }
- }
- }
- Rectangle{
- id: rect
- width: parent.width/2
- height: 80
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- color: "yellow"
- TextArea{
- id: seltextid
- anchors.top: parent.top
- backgroundVisible: false
- width: parent.width
- height: parent.height
- }
- }
- Rectangle{
- id: rectin
- width: parent.width/2
- height: 80
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- color: "orange"
- TextInput {
- id: inputText
- text: "Paprika"
- onAccepted: {
- manager.textInputSlot(inputText.text);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement