Skip to content

Commit

Permalink
Refs #2, Connecting data sources.
Browse files Browse the repository at this point in the history
  • Loading branch information
doumdi committed Mar 11, 2024
1 parent 817be17 commit 311ed9b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Item {
property bool autoFetch: false

signal error(var errorMessage);
signal itemClicked(var item);

function getAll() {
var reply = UserClient.get(url, params);
Expand All @@ -26,7 +27,8 @@ Item {

//Add session
response.forEach(function(item) {
myModel.append(item)
item.dataSource = baseDataSource;
myModel.append(item);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ BaseDataSource {
fieldDisplayName: "session_name"
iconPath: "qrc:/genericIcon"

function setParticipant(id_participant) {
fetch.id_participant = id_participant;
getAll();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Item {
// Customize delegate appearance as needed
Text {
height: 20
text: "Name: " + model[myDelegate.ListView.view.fieldDisplayName]
text: "Name: " + model[model.dataSource.fieldDisplayName]
color: "red"
}
/*
Expand All @@ -50,7 +50,8 @@ Item {
id: mouseArea
anchors.fill: parent
onClicked: {
itemClicked(model[myDelegate.ListView.view.fieldIdName]);
console.log("GenericItemDelegate clicked.")
model.dataSource.itemClicked(model[model.dataSource.fieldIdName])
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Frontend/DashboardsViewer/content/widgets/ListViewWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ BaseWidget {
property string fieldIdName: dataSource.fieldIdName
property string iconPath: dataSource.iconPath




}
/*
ListModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
"target": {"object": "participantListData", "slot": "update", "args": []}
},
{
"source": {"object": "participantList.delegate", "signal": "onItemClicked"},
"source": {"object": "participantListData", "signal": "onItemClicked"},
"target": {"object": "participantSessionListData", "slot": "setParticipant", "args": ["id_participant"]}
}
]
Expand Down

0 comments on commit 311ed9b

Please sign in to comment.