QNetworkSettingsUserAgent Class

The QNetworkSettingsUserAgent represents the user credentials for connecting to a network. More...

Header: #include <QNetworkSettingsUserAgent>
qmake: QT += networksettings
Inherits: QObject

Public Functions

QNetworkSettingsUserAgent(QObject *parent = Q_NULLPTR)
void cancelInput()
void clearConnectionState()
QString passphrase() const
void setPassphrase(const QString &passphrase)
void setSsidAndPassphrase(const QString &ssid, const QString &passphrase)

Signals

void error()
void ready(bool cancel)
void requestNextConnection()
void showUserCredentialsInput()

Detailed Description

The QNetworkSettingsService::connectService() method is used to connect to a Wifi network. The network name is specified by using a service set identifier (SSID). If no password is needed, the connection is created immediately. QNetworkSettingsService::state property can be used to monitor the state of the connection.

If a password is needed, the QNetworkSettingsUserAgent::showUserCredentialsInput() signal is emitted. To create a connection, the password is set by using the QNetworkSettingsUserAgent::setPassphrase() method.

See also QNetworkSettingsManager.

Member Function Documentation

QNetworkSettingsUserAgent::QNetworkSettingsUserAgent(QObject *parent = Q_NULLPTR)

Creates a user agent with the parent parent.

[signal] void QNetworkSettingsUserAgent::error()

This signal is emitted when the connection failed due to invalid user credentials.

[signal] void QNetworkSettingsUserAgent::ready(bool cancel)

This signal is emitted when the user has either submitted the password for the network, or if cancel is true, cancelled the password query.

[signal] void QNetworkSettingsUserAgent::requestNextConnection()

This signal is emitted when the network manager attempts to connect using the next network interface in the model.

[signal] void QNetworkSettingsUserAgent::showUserCredentialsInput()

This signal is emitted when user credentials are required for connecting to a Wifi network.

See also QNetworkSettingsService::connectService().

void QNetworkSettingsUserAgent::cancelInput()

Cancels the user credentials input request.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

void QNetworkSettingsUserAgent::clearConnectionState()

Clears the connection state.

QString QNetworkSettingsUserAgent::passphrase() const

Returns the password of the user agent.

See also setPassphrase().

void QNetworkSettingsUserAgent::setPassphrase(const QString &passphrase)

Sets the password for connecting to a Wifi network to passphrase.

This method needs to be called in response to receiving the showUserCredentialsInput() signal.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

See also passphrase().

void QNetworkSettingsUserAgent::setSsidAndPassphrase(const QString &ssid, const QString &passphrase)

Sets the name of the network to ssid and the password of the user agent to passphrase.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.