The QBluetoothTransferReply class stores the response for a data transfer request. 更多...
头: | #include <QBluetoothTransferReply> |
qmake: | QT += bluetooth |
Since: | Qt 5.2 |
继承: | QObject |
enum | TransferError { NoError, UnknownError, FileNotFoundError, HostNotFoundError, ..., SessionError } |
~QBluetoothTransferReply () | |
virtual TransferError | error () const = 0 |
virtual QString | errorString () const = 0 |
virtual bool | isFinished () const = 0 |
virtual bool | isRunning () const = 0 |
QBluetoothTransferManager * | manager () const |
QBluetoothTransferRequest | request () const |
void | abort () |
void | error (QBluetoothTransferReply::TransferError errorType ) |
void | finished (QBluetoothTransferReply * reply ) |
void | transferProgress (qint64 bytesTransferred , qint64 bytesTotal ) |
QBluetoothTransferReply (QObject * parent = Q_NULLPTR) | |
void | setManager (QBluetoothTransferManager * manager ) |
void | setRequest (const QBluetoothTransferRequest & request ) |
The QBluetoothTransferReply class stores the response for a data transfer request.
In additional to a copy of the QBluetoothTransferRequest object used to create the request, QBluetoothTransferReply contains the contents of the reply itself.
After the file transfer has started, QBluetoothTransferReply 发射 transferProgress () signal, which indicates the progress of the file transfer.
This enum describes the type of error that occurred
常量 | 值 | 描述 |
---|---|---|
QBluetoothTransferReply::NoError
|
0
|
没有错误。 |
QBluetoothTransferReply::UnknownError
|
1
|
Unknown error, no better enum available. |
QBluetoothTransferReply::FileNotFoundError
|
2
|
Unable to open the file specified. |
QBluetoothTransferReply::HostNotFoundError
|
3
|
Unable to connect to the target host. |
QBluetoothTransferReply::UserCanceledTransferError
|
4
|
User terminated the transfer. |
QBluetoothTransferReply::IODeviceNotReadableError
|
5
|
File was not open before initiating the sending command. |
QBluetoothTransferReply::ResourceBusyError
|
6
|
Unable to access the resource.. |
QBluetoothTransferReply::SessionError
|
7
|
An error occurred during the handling of the session. This enum was introduced by Qt 5.4. |
[protected]
QBluetoothTransferReply::
QBluetoothTransferReply
(
QObject
*
parent
= Q_NULLPTR)
构造新的 QBluetoothTransferReply with parent .
销毁 QBluetoothTransferReply 对象。
[slot]
void
QBluetoothTransferReply::
abort
()
Aborts this reply.
[pure virtual]
TransferError
QBluetoothTransferReply::
error
() const
The error code of the error that occurred.
另请参阅 errorString ().
[signal]
void
QBluetoothTransferReply::
error
(
QBluetoothTransferReply::TransferError
errorType
)
This signal is emitted whenever an error has occurred. The errorType parameter indicates the type of error.
To avoid the loss of signal emissions it is recommend to immidiately connect to this signal once a QBluetoothTransferReply instance has been created.
注意: 信号 error 在此类中是重载。要使用函数指针句法连接到此信号,必须在静态铸造中指定信号类型,如此范例所示:
connect(bluetoothTransferReply, static_cast<void(QBluetoothTransferReply::*)(QBluetoothTransferReply::TransferError)>(&QBluetoothTransferReply::error), [=](QBluetoothTransferReply::TransferError errorType){ /* ... */ });
该函数在 Qt 5.4 引入。
另请参阅 error () 和 errorString ().
[pure virtual]
QString
QBluetoothTransferReply::
errorString
() const
String describing the error. Can be displayed to the user.
另请参阅 error ().
[signal]
void
QBluetoothTransferReply::
finished
(
QBluetoothTransferReply
*
reply
)
This signal is emitted when the transfer is complete for reply .
To avoid the loss of signal emissions it is recommend to immidiately connect to this signal once a
QBluetoothTransferReply
instance has been created.
[pure virtual]
bool
QBluetoothTransferReply::
isFinished
() const
Returns true if this reply has finished, otherwise false.
[pure virtual]
bool
QBluetoothTransferReply::
isRunning
() const
Returns true if this reply is running, otherwise false.
返回 QBluetoothTransferManager 用于创建此 QBluetoothTransferReply 对象。最初,它还是父级对象。
另请参阅 setManager ().
返回 QBluetoothTransferRequest 用于创建此 QBluetoothTransferReply 对象。
另请参阅 setRequest ().
[protected]
void
QBluetoothTransferReply::
setManager
(
QBluetoothTransferManager
*
manager
)
Set the reply's manager to the manager .
另请参阅 manager ().
[protected]
void
QBluetoothTransferReply::
setRequest
(const
QBluetoothTransferRequest
&
request
)
Set the reply's request to request .
另请参阅 request ().
[signal]
void
QBluetoothTransferReply::
transferProgress
(
qint64
bytesTransferred
,
qint64
bytesTotal
)
This signal is emitted whenever data is transferred. The bytesTransferred parameter contains the total number of bytes transferred so far out of bytesTotal .
To avoid the loss of signal emissions it is recommend to immidiately connect to this signal once a QBluetoothTransferReply instance has been created.