main.qml 648 B

1234567891011121314151617181920212223242526272829303132
  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. if(idItf.initialize())
  16. {
  17. var ifs = idItf.getInterface("eth0");
  18. if(ifs.length > 0)
  19. {
  20. console.log(ifs[0].ipAddress);
  21. }
  22. else
  23. {
  24. console.log("No interface found!");
  25. }
  26. }
  27. }
  28. }
  29. }