12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import QtQuick 2.6
- import QtQuick.Window 2.2
- import gfa.plugins.qml.net 1.0
- Window {
- visible: true
- width: 640
- height: 480
- title: qsTr("Hello World")
- Text {
- id: idIpAddr
- x: 5
- y: 40
- color: "blue"
- font.pixelSize: 14
- text: idItf.interfaces[0].ipAddress.address
- }
- NetInterfaces {
- id: idItf
- // itfFilterName: "eth0"
- itfFilterAF: Interface.AF_Inet
- itfFilterMethod: Interface.IM_Static | Interface.IM_Manual
- onSigError:
- {
- console.error(msg);
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked:
- {
- if(idItf.filteredInterfaces.length > 0)
- {
- idItf.filteredInterfaces[0].ipAddress.address = "192.168.0.256";
- idItf.filteredInterfaces[0].ipAddress.address = "155.18.2.156";
- idItf.filteredInterfaces[0].ipAddress.b0 = 255;
- console.log(idItf.filteredInterfaces[0].ipAddress.address);
- }
- else
- {
- console.warn("No interface found!");
- }
- idItf.itfFilterMethod |= Interface.IM_Dhcp;
- // idItf.itfFilterName = "eth1";
- idItf.itfFilterMethod &= ~Interface.IM_Static;
- idItf.filteredInterfaces[0].af = Interface.AF_Unknown;
- // idItf.saveAs("/home/wrk/share/gfanet/libgfanet/res/testitf");
- }
- }
- }
|