-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibrarySelectionPage.qml
40 lines (38 loc) · 1.14 KB
/
LibrarySelectionPage.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
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.blumia.pineapple.comic.reader
import net.blumia.pineapple.comic.reader.libraryitem
Control {
anchors.fill: parent
padding: 5
contentItem: ColumnLayout {
Label {
text: "Libraries"
font.pixelSize: 20
}
ListView {
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
model: DelegateModel {
model: AppController.librariesModel
delegate: ItemDelegate {
text: model.display
width: ListView.view.width
onClicked: function() {
AppController.selectedLibraryId = model.libraryId
}
}
onCountChanged: function() {
if (count == 1) {
AppController.selectedLibraryId = model.data(modelIndex(0), LibraryItem.IdRole)
}
}
}
}
Component.onCompleted: function() {
AppController.updateLibraries()
}
}
}