-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRecipeSmallItem.qml
131 lines (105 loc) · 3.01 KB
/
RecipeSmallItem.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import QtQuick 2.5
import QtQuick.Controls 2.1
Item {
id:smallRecipe
width:recipesListView.width
height:40
//anchors.horizontalCenter: parent.horizontalCenter
signal recipeClicked(string title, string instructions, string notes)
Loader {
id:loader
width:300
height:300
anchors.rightMargin: 0
anchors.fill: parent
visible: source != ""
}
Row {
id: row1
width: recipesListView.width
height: 40
visible: !loader.visible
Image {
id:icon
width: 40
height: 40
fillMode: Image.PreserveAspectFit
source: thumb
}
Text {
text: title
anchors.verticalCenter: parent.verticalCenter
font.bold: true
}
spacing: 10
RatingIndicator {
anchors.verticalCenter: parent.verticalCenter
indicator_rating: rating
}
}
/*Component.onCompleted: {
console.log("data:", model)
}*/
MouseArea {
id: mouseArea1
anchors.fill: parent
onClicked: parent.state = "expanded"
/*onClicked: {
console.log(modelData.title);
smallRecipe.recipeClicked(modelData.title, modelData.instructions, modelData.notes)
}*/
}
Button {
id: closeButton
anchors.right: parent.right
anchors.top: parent.top
anchors.rightMargin: 2
anchors.topMargin: 2
text: qsTr("Close")
//color: "#157efb"
//border.color: Qt.lighter(color, 1.1)
opacity: 0
onClicked: smallRecipe.state = ""
}
states: [
State {
name: "expanded"
PropertyChanges {
target: closeButton
opacity: 1
}
PropertyChanges {
target: smallRecipe
height:recipesListView.height
}
PropertyChanges {
target: mouseArea1
enabled:false
}
PropertyChanges {
target: recipesListView
//smallRecipe.ListView.view
contentY:smallRecipe.y
interactive:false
}
PropertyChanges {
target: loader
source:"RecipeFullItem.qml"
x:0
y:0
anchors.rightMargin: 0
anchors.bottomMargin: 0
anchors.leftMargin: 0
anchors.topMargin: 0
}
}
]
transitions: [
Transition {
NumberAnimation {
duration: 200;
properties: "height,width,anchors.rightMargin,anchors.topMargin,opacity,contentY"
}
}
]
}