diff --git a/2024/tp4_reseau/NetIf.qml b/2024/tp4_reseau/NetIf.qml index 2a14451..2484bc8 100644 --- a/2024/tp4_reseau/NetIf.qml +++ b/2024/tp4_reseau/NetIf.qml @@ -1,11 +1,12 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 +import trump.hatesScience 1.0 Row { property alias name: name.text property alias address: address.text - + property NetworkInterface iface spacing: 40 Text { @@ -21,7 +22,10 @@ Row { Button { text: "Shutdown" - onClicked: { netint.shutdown() } + onClicked: { + console.log("Sutting down") + parent.iface.shutdown() + } anchors.verticalCenter: parent.verticalCenter } } diff --git a/2024/tp4_reseau/main.cpp b/2024/tp4_reseau/main.cpp index 59cd1fe..f77ee72 100644 --- a/2024/tp4_reseau/main.cpp +++ b/2024/tp4_reseau/main.cpp @@ -24,6 +24,9 @@ int main(int argc, char *argv[]) Qt::QueuedConnection); NetworkInterface ni{3}; + qmlRegisterUncreatableType("trump.hatesScience",1,0, + "NetworkInterface", + "Don't build NetworkInterface from QML"); engine.rootContext()->setContextProperty("netint", &ni); engine.load(url); diff --git a/2024/tp4_reseau/main.qml b/2024/tp4_reseau/main.qml index 3fbd731..30ee661 100644 --- a/2024/tp4_reseau/main.qml +++ b/2024/tp4_reseau/main.qml @@ -12,6 +12,7 @@ Window { NetIf { name: netint.name address: netint.address + iface: netint } }