8import QtQuick.Controls as QQC2
9import org.kde.kirigami as Kirigami
10import org.kde.kopeninghours
15 required property string name
16 required property string typeName
17 required property string iconSource
18 required property string detailsLabel
19 required property string fallbackName
20 required property string openingHours
21 required property point coordinate
22 required property string timeZone
23 required property string regionCode
25 required property int index
28 width: ListView.view.width
31 let v = OpeningHoursParser.parse(root.openingHours);
32 v.region = root.regionCode;
33 v.timeZone = root.timeZone;
34 v.setLocation(root.coordinate.y, root.coordinate.x);
35 if (v.error != OpeningHours.Null && v.error != OpeningHours.NoError) {
36 console.log(
"Opening hours parsing error:", root.openingHours, v.error, root.regionCode, root.timeZone)
41 contentItem: RowLayout {
45 Layout.minimumHeight:
Kirigami.Units.iconSizes.medium
46 Layout.maximumHeight:
Kirigami.Units.iconSizes.medium
47 Layout.minimumWidth:
Kirigami.Units.iconSizes.medium
48 Layout.maximumWidth:
Kirigami.Units.iconSizes.medium
49 source: root.iconSource
54 Layout.alignment:
Qt.AlignVCenter
55 Layout.fillWidth:
true
59 Layout.alignment:
Qt.AlignLeft |
Qt.AlignBottom
60 Layout.fillWidth:
true
61 text: root.name !==
"" ? root.name : root.typeName
62 elide:
Text.ElideRight
66 Layout.alignment:
Qt.AlignLeft |
Qt.AlignTop
67 Layout.fillWidth:
true
69 if (root.detailsLabel && root.name ===
"")
70 return root.detailsLabel;
71 if (root.detailsLabel)
72 return i18n(
"%1 (%2)", root.typeName, root.detailsLabel);
73 return root.name ===
"" && root.fallbackName !==
"" ? root.fallbackName : root.typeName;
75 elide:
Text.ElideRight
81 Layout.fillWidth:
true
82 text:
Display.currentState(root.oh)
84 if (root.highlighted || root.checked || root.down)
85 return Kirigami.Theme.highlightedTextColor
86 const currentInterval = root.oh.interval(
new Date());
87 switch (currentInterval.state) {
88 case Interval.Open:
return Kirigami.Theme.positiveTextColor;
89 case Interval.Closed:
return Kirigami.Theme.negativeTextColor;
90 default:
return Kirigami.Theme.textColor;
93 elide:
Text.ElideRight
QString i18n(const char *text, const TYPE &arg...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:55:43 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.