mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
implemented amounts in gui
This commit is contained in:
+116
-3
@@ -30,6 +30,13 @@ component GoodListItem inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
opacity: (root.item.checked ? 0.5 : 1.0);
|
||||
font-size: 12pt;
|
||||
text: root.item.amount;
|
||||
width: 30px;
|
||||
}
|
||||
|
||||
Text {
|
||||
opacity: (root.item.checked ? 0.5 : 1.0);
|
||||
font-size: 12pt;
|
||||
@@ -42,6 +49,94 @@ component GoodListItem inherits Rectangle {
|
||||
//root.item.checked = !root.item.checked;
|
||||
State.check-item(item.name);
|
||||
}
|
||||
mouse-cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
component PlusMinus inherits HorizontalLayout {
|
||||
in property <SItem> item;
|
||||
plus := Rectangle {
|
||||
Text {
|
||||
text: "+";
|
||||
font-weight: 800;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
background: #ffffff10;
|
||||
border-top-left-radius: 10px;
|
||||
border-bottom-left-radius: 10px;
|
||||
border-color: #00000070;
|
||||
border-width: 1px;
|
||||
width: self.height;
|
||||
plusta := TouchArea {
|
||||
clicked => {
|
||||
State.inc-amount(item.name);
|
||||
}
|
||||
mouse-cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
minus := Rectangle {
|
||||
Text {
|
||||
text: "-";
|
||||
font-weight: 800;
|
||||
font-size: 16pt;
|
||||
}
|
||||
|
||||
background: #ffffff10;
|
||||
border-top-right-radius: 10px;
|
||||
border-bottom-right-radius: 10px;
|
||||
border-color: #00000070;
|
||||
border-width: 1px;
|
||||
height: 30px;
|
||||
width: self.height;
|
||||
minusta := TouchArea {
|
||||
clicked => {
|
||||
State.dec-amount(item.name);
|
||||
}
|
||||
mouse-cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
states [
|
||||
plushov when plusta.has-hover: {
|
||||
plus.background: #ffffff30;
|
||||
}
|
||||
minoshov when minusta.has-hover: {
|
||||
minus.background: #ffffff30;
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
component GoodListItemAdd inherits Rectangle {
|
||||
in-out property <SItem> item;
|
||||
background: #ffffff10;
|
||||
border-radius: 8pt;
|
||||
border-width: 10pt;
|
||||
HorizontalLayout {
|
||||
spacing: 8px;
|
||||
padding: 8px;
|
||||
alignment: start;
|
||||
PlusMinus {
|
||||
item: item;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 30px;
|
||||
Text {
|
||||
text: root.item.amount;
|
||||
font-size: 12pt;
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 30px;
|
||||
Text {
|
||||
opacity: (root.item.checked ? 0.5 : 1.0);
|
||||
font-size: 12pt;
|
||||
text: root.item.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +158,24 @@ component GoodsList {
|
||||
}
|
||||
}
|
||||
|
||||
component GoodsListAdd {
|
||||
in property <[SItem]> items;
|
||||
|
||||
ListView {
|
||||
mouse-drag-pan-enabled: true;
|
||||
|
||||
for item in items: VerticalLayout {
|
||||
GoodListItemAdd {
|
||||
item: item;
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
height: 4pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component GoodButtons inherits ScrollView {
|
||||
in property <[string]> favorites: ["Mjölk", "Ost", "Ägg", "Bullens", "Oboy", "Mjöl", "Havregryn", "KrosTom"];
|
||||
in property <int> button-width: 100;
|
||||
@@ -104,9 +217,9 @@ component AddView inherits VerticalLayout {
|
||||
padding: 8px;
|
||||
spacing: 8px;
|
||||
|
||||
RefreshButton {}
|
||||
RefreshButton { }
|
||||
|
||||
goods := GoodsList {
|
||||
goods := GoodsListAdd {
|
||||
items <=> list;
|
||||
}
|
||||
|
||||
@@ -148,7 +261,7 @@ component ShopView inherits VerticalLayout {
|
||||
padding: 8px;
|
||||
spacing: 8px;
|
||||
|
||||
RefreshButton {}
|
||||
RefreshButton { }
|
||||
|
||||
goods := GoodsList {
|
||||
items <=> list;
|
||||
|
||||
Reference in New Issue
Block a user