qurloperator.html
来自「QT 下载资料仅供参考」· HTML 代码 · 共 511 行 · 第 1/3 页
HTML
511 行
is listed and <a href="#finished">finished</a>() is emitted after the last one. The<a href="#newChildren">newChildren</a>() signal is emitted for each list of new entries. Ifan error occurs, the signal finished() is emitted, so be sure tocheck the state of the network operation pointer.<p> Because the operation may not be executed immediately, a pointerto the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function isreturned. This object contains all the data about the operationand is used to refer to this operation later (e.g. in the signalsthat are emitted by the QUrlOperator). The return value can alsobe 0 if the operation object couldn't be created.<p> The path of this QUrlOperator must to point to a directory(because the children of this directory will be listed), not to afile.<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="mkdir"></a>QUrlOperator::mkdir ( const <a href="qstring.html">QString</a> & dirname )<tt> [virtual]</tt></h3>Tries to create a directory (child) with the name <em>dirname</em>. Ifit is successful, a <a href="#newChildren">newChildren</a>() signal with the new child isemitted, and the <a href="#createdDirectory">createdDirectory</a>() signal with the informationabout the new child is also emitted. The <a href="#finished">finished</a>() signal (withsuccess or failure) is emitted after the operation has beenprocessed, so check the state of the network operation object tosee whether or not the operation was successful.<p> Because the operation will not be executed immediately, a pointerto the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function isreturned. This object contains all the data about the operationand is used to refer to this operation later (e.g. in the signalsthat are emitted by the QUrlOperator). The return value can alsobe 0 if the operation object couldn't be created.<p> The path of this QUrlOperator must to point to a directory (not afile) because the new directory will be created in this path.<h3 class=fn><a href="qstring.html">QString</a> <a name="nameFilter"></a>QUrlOperator::nameFilter () const</h3>Returns the name filter of the URL.<p> <p>See also <a href="#setNameFilter">QUrlOperator::setNameFilter</a>() and <a href="qdir.html#nameFilter">QDir::nameFilter</a>().<h3 class=fn>void <a name="newChildren"></a>QUrlOperator::newChildren ( const <a href="qvaluelist.html">QValueList</a><QUrlInfo> & i, <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt></h3><p> This signal is emitted after <a href="#listChildren">listChildren</a>() was called and newchildren (i.e. files) have been read from a list of files. <em>i</em>holds the information about the new files. <em>op</em> is a pointerto the operation object which contains all the information aboutthe operation, including the state.<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="put"></a>QUrlOperator::put ( const <a href="qbytearray.html">QByteArray</a> & data, const <a href="qstring.html">QString</a> & location = QString::null )<tt> [virtual]</tt></h3>This function tells the network protocol to put <em>data</em> in <em>location</em>. If <em>location</em> is empty (QString::null), it puts the <em>data</em> in the location to which the URL points. What happens dependson the network protocol. Depending on the network protocol, somedata might come back after putting data, in which case the <a href="#data">data</a>()signal is emitted. The <a href="#dataTransferProgress">dataTransferProgress</a>() signal is emittedduring processing of the operation. At the end, <a href="#finished">finished</a>() (withsuccess or failure) is emitted, so check the state of the networkoperation object to see whether or not the operation wassuccessful.<p> If <em>location</em> is <a href="qstring.html#QString-null">QString::null</a>, the path of this QUrlOperatorshould point to a file when you use this operation. If <em>location</em>is not empty, it can be a relative (a child of the path to whichthe QUrlOperator points) or an absolute URL.<p> For putting some data to a file you can do the following:<p> <pre> QUrlOperator op( "ftp://ftp.whatever.com/home/me/filename.dat" ); op.<a href="#put">put</a>( data ); </pre> <p> For most other operations, the path of the QUrlOperator must pointto a directory. If you want to upload data to a file you could dothe following:<p> <pre> QUrlOperator op( "ftp://ftp.whatever.com/home/me" ); // do some other stuff like op.<a href="#listChildren">listChildren</a>() or op.<a href="#mkdir">mkdir</a>( "new_dir" ) op.<a href="#put">put</a>( data, "filename.dat" ); </pre> <p> This will upload the data to ftp://ftp.whatever.com/home/me/filename.dat.<p> <p>See also <a href="#copy">copy</a>().<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="remove"></a>QUrlOperator::remove ( const <a href="qstring.html">QString</a> & filename )<tt> [virtual]</tt></h3>Tries to remove the file (child) <em>filename</em>. If it succeeds the<a href="#removed">removed</a>() signal is emitted. <a href="#finished">finished</a>() (with success or failure)is also emitted after the operation has been processed, so checkthe state of the network operation object to see whether or notthe operation was successful.<p> Because the operation will not be executed immediately, a pointerto the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function isreturned. This object contains all the data about the operationand is used to refer to this operation later (e.g. in the signalsthat are emitted by the QUrlOperator). The return value can alsobe 0 if the operation object couldn't be created.<p> The path of this QUrlOperator must point to a directory; becauseif <em>filename</em> is relative, it will try to remove it in thisdirectory.<h3 class=fn>void <a name="removed"></a>QUrlOperator::removed ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt></h3><p> This signal is emitted when <a href="#remove">remove</a>() has been succesful and thefile has been removed.<p> <em>op</em> is a pointer to the operation object which contains all theinformation about the operation, including the state.<tt>op->arg(0)</tt> holds the name of the file that was removed.<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.<h3 class=fn>const <a href="qnetworkoperation.html">QNetworkOperation</a> * <a name="rename"></a>QUrlOperator::rename ( const <a href="qstring.html">QString</a> & oldname, const <a href="qstring.html">QString</a> & newname )<tt> [virtual]</tt></h3>Tries to rename the file (child) called <em>oldname</em> to <em>newname</em>.If it succeeds, the <a href="#itemChanged">itemChanged</a>() signal is emitted. <a href="#finished">finished</a>()(with success or failure) is also emitted after the operation hasbeen processed, so check the state of the network operation objectto see whether or not the operation was successful.<p> Because the operation may not be executed immediately, a pointerto the <a href="qnetworkoperation.html">QNetworkOperation</a> object created by this function isreturned. This object contains all the data about the operationand is used to refer to this operation later (e.g. in the signalsthat are emitted by the QUrlOperator). The return value can alsobe 0 if the operation object couldn't be created.<p> This path of this QUrlOperator must to point to a directorybecause <em>oldname</em> and <em>newname</em> are handled relative to thisdirectory.<h3 class=fn>void <a name="setNameFilter"></a>QUrlOperator::setNameFilter ( const <a href="qstring.html">QString</a> & nameFilter )<tt> [virtual]</tt></h3>Sets the name filter of the URL to <em>nameFilter</em>.<p> <p>See also <a href="qdir.html#setNameFilter">QDir::setNameFilter</a>().<h3 class=fn>void <a name="start"></a>QUrlOperator::start ( <a href="qnetworkoperation.html">QNetworkOperation</a> * op )<tt> [signal]</tt></h3><p> Some operations (such as <a href="#listChildren">listChildren</a>()) emit this signal whenthey start processing the operation. <em>op</em> is a pointer to theoperation object which contains all the information about theoperation, including the state.<p> <p>See also <a href="qnetworkoperation.html">QNetworkOperation</a> and <a href="qnetworkprotocol.html">QNetworkProtocol</a>.<h3 class=fn>void <a name="startedNextCopy"></a>QUrlOperator::startedNextCopy ( const <a href="qptrlist.html">QPtrList</a><QNetworkOperation> & lst )<tt> [signal]</tt></h3><p> This signal is emitted if <a href="#copy">copy</a>() starts a new copy operation. <em>lst</em> contains all QNetworkOperations related to this copyoperation.<p> <p>See also <a href="#copy">copy</a>().<h3 class=fn>void <a name="stop"></a>QUrlOperator::stop ()<tt> [virtual]</tt></h3>Stops the current network operation and removes all thisQUrlOperator's waiting network operations.<hr><h2>Related Functions</h2><h3 class=fn>void <a name="qInitNetworkProtocols"></a>qInitNetworkProtocols ()</h3><p> This function registers the network protocols for FTP and HTTP. You have tocall this function before you use QUrlOperator for these protocols.<p> This function is declared in <a href="qnetwork-h.html">qnetwork.h</a>.<!-- eof --><hr><p>This file is part of the <a href="index.html">Qt toolkit</a>.Copyright © 1995-2002<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center><table width=100% cellspacing=0 border=0><tr><td>Copyright © 2002 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a><td align=right><div align=right>Qt version 3.0.5</div></table></div></address></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?