7import QtQuick.Controls as QQC2
8import org.kde.kirigami as Kirigami
9import org.kde.kosmindoormap
12Kirigami.SearchDialog {
16 property RoomModel roomModel
19 signal roomSelected(room: var)
21 width: Math.min(applicationWindow().width, Kirigami.Units.gridUnit * 24)
22 height: Math.min(applicationWindow().height, Kirigami.Units.gridUnit * 32)
24 searchFieldPlaceholderText: i18nd("kosmindoormap",
"Search room…")
25 model: RoomSortFilterProxyModel {
27 sourceModel: root.visible ? root.roomModel : null
33 required property string name
34 required property string
number
36 required property string levelLongName
37 required property int
level
38 required property osmElement element
40 width: ListView.view.width
45 if (item.number ===
"")
47 return i18nd(
"kosmindoormap",
"%1 (%2)", item.name, item.number);
50 if (root.roomModel.buildingCount === 1)
52 if (item.typeName ===
"")
53 return item.levelLongName;
54 return i18nd(
"kosmindoormap",
"%1 (%2)", item.typeName, item.levelLongName);
58 root.roomSelected({ element: item.element,
level: item.level });
62 Keys.onPressed: (
event) => {
64 event.accepted =
true;
65 root.roomSelected({ element: item.element,
level: item.level });
71 section.property: root.roomModel.buildingCount !== 1 ?
"buildingName" :
"levelLongName"
72 section.delegate:
Kirigami.ListSectionHeader {
74 width: ListView.view.width
77 onTextChanged: roomSortModel.filterString = root.text
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
KIOCORE_EXPORT QString number(KIO::filesize_t size)
QString typeName(const QJsonObject &obj)
QStringView level(QStringView ifopt)