Premier jet

main
Alexis Drai 2 years ago
parent d6a09759fe
commit 04a887578d

@ -14,7 +14,8 @@ TARGET = qt3
CONFIG += sailfishapp
SOURCES += src/qt3.cpp
SOURCES += src/qt3.cpp \
src/networkinterface.cpp
DISTFILES += qml/qt3.qml \
qml/cover/CoverPage.qml \
@ -37,3 +38,6 @@ CONFIG += sailfishapp_i18n
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
TRANSLATIONS += translations/qt3-de.ts
HEADERS += \
src/networkinterface.h

@ -0,0 +1,11 @@
#include "networkinterface.h"
NetworkInterface::NetworkInterface(const QNetworkInterface& networkInterface, QObject *parent)
: QObject(parent), m_networkInterface(networkInterface)
{
}
QString NetworkInterface::name() const
{
return m_networkInterface.name();
}

@ -0,0 +1,22 @@
#ifndef NETWORKINTERFACE_H
#define NETWORKINTERFACE_H
#include <QObject>
#include <QNetworkInterface>
class NetworkInterface : public QObject
{
Q_OBJECT
public:
explicit NetworkInterface(const QNetworkInterface& networkInterface, QObject *parent = nullptr);
Q_INVOKABLE QString name() const;
private:
QNetworkInterface m_networkInterface;
signals:
public slots:
};
#endif // NETWORKINTERFACE_H

@ -1,5 +1,6 @@
#ifdef QT_QML_DEBUG
#include <QtQuick>
#include "networkinterface.h"
#endif
#include <sailfishapp.h>
@ -15,6 +16,8 @@ int main(int argc, char *argv[])
// - SailfishApp::pathToMainQml() to get a QUrl to the main QML file
//
// To display the view, call "show()" (will show fullscreen on device).
NetworkInterface ni(QNetworkInterface::interfaceFromName("lo"));
qDebug() << ni.name();
return SailfishApp::main(argc, argv);
}

Loading…
Cancel
Save