networkinformation.h
/**
* 书本:【Qt5开发及实例】
* 功能:获取本机网络信息
* 文件:networkinformation.h
* 时间:2015年2月5日14:51:33
* 作者:cutter_point
*/
#ifndef NETWORKINFORMATION_H
#define NETWORKINFORMATION_H
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QGridLayout>
#include <QHostInfo>
#include <QNetworkInterface>
#include <QMessageBox>
class NetworkInformation : public QWidget
{
Q_OBJECT
public:
NetworkInformation(QWidget *parent = 0);
~NetworkInformation();
void getHostInformation(); //得到主机信息
public slots:
void slotDetail(); //展示详细信息
private:
//界面布局
QLabel *hostLabel;
QLineEdit *LineEditLocalHostName;
QLabel *ipLabel;
QLineEdit *LineEditAddress;
QPushButton *detailBtn;
QGridLayout *mainLayout;
};
#endif // NETWORKINFORMATION_H
networkinformation.cpp