main.qml 657 B

12345678910111213141516171819202122232425262728293031323334
  1. import QtQuick 2.6
  2. import QtQuick.Window 2.2
  3. import gfa.plugins.qml.net 1.0
  4. Window {
  5. visible: true
  6. width: 640
  7. height: 480
  8. title: qsTr("Hello World")
  9. NetInterfaces {
  10. id: idItf
  11. }
  12. MouseArea {
  13. anchors.fill: parent
  14. onClicked:
  15. {
  16. if(idItf.initialize())
  17. {
  18. var ifs = idItf.getInterface("eth1");
  19. if(ifs.length > 0)
  20. {
  21. console.log(ifs[0].ipAddress);
  22. }
  23. else
  24. {
  25. console.log("No interface found!");
  26. }
  27. }
  28. }
  29. }
  30. }