summaryrefslogtreecommitdiffstats
path: root/src/networksettings/qnetworksettingsinterfacemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/networksettings/qnetworksettingsinterfacemodel.cpp')
-rw-r--r--src/networksettings/qnetworksettingsinterfacemodel.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/networksettings/qnetworksettingsinterfacemodel.cpp b/src/networksettings/qnetworksettingsinterfacemodel.cpp
index 72ea805..ff234ac 100644
--- a/src/networksettings/qnetworksettingsinterfacemodel.cpp
+++ b/src/networksettings/qnetworksettingsinterfacemodel.cpp
@@ -31,6 +31,33 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsInterfaceModel
+ \inmodule QtDeviceUtilities
+ \brief The QNetworkSettingsInterfaceModel class represents a network
+ interface model.
+
+ The network interface model contains a list of network interfaces
+ attached to the host.
+*/
+
+/*!
+ \enum QNetworkSettingsInterfaceModel::Roles
+ \brief This enum type holds information about a network interface.
+
+ \value Type
+ Network interface \l{QNetworkSettingsType::Types}{type}.
+ \value Status
+ Network interface \l{QNetworkSettingsState::States}{state}.
+ \value Name
+ Network interface name.
+ \value Powered
+ Whether the network interface is powered on or off.
+*/
+
+/*!
+ Creates a new network interface model with the parent \a parent.
+*/
QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent)
: QAbstractListModel(parent)
{
@@ -41,18 +68,27 @@ QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent)
m_roleNames.insert(Powered, "powered");
}
+/*!
+ Returns an array of the names of the roles in the model.
+*/
QHash<int, QByteArray> QNetworkSettingsInterfaceModel::roleNames() const
{
return m_roleNames;
}
-
+/*!
+ Returns the number of rows in the model with the parent \a parent.
+*/
int QNetworkSettingsInterfaceModel::rowCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
return m_items.count();
}
+/*!
+ Returns the data at the index \a index in the model for the type of data
+ specified by \a role.
+*/
QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int role) const
{
if (!index.isValid()) return QVariant();
@@ -81,6 +117,9 @@ QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int rol
}
+/*!
+ Appends \a item to the model.
+*/
void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -90,6 +129,9 @@ void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item)
endInsertRows();
}
+/*!
+ Inserts \a item into \a row in the model.
+*/
void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -99,6 +141,9 @@ void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface*
endInsertRows();
}
+/*!
+ Removes the row \a row from the model.
+*/
void QNetworkSettingsInterfaceModel::remove(int row)
{
beginRemoveRows(QModelIndex(), row, row);
@@ -106,6 +151,9 @@ void QNetworkSettingsInterfaceModel::remove(int row)
endRemoveRows();
}
+/*!
+ Returns the network interface model.
+*/
QList<QNetworkSettingsInterface*> QNetworkSettingsInterfaceModel::getModel()
{
return m_items;