⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qurloperator.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
'\" t.TH QUrlOperator 3qt "9 December 2002" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQUrlOperator \- Common operations on URLs.SH SYNOPSIS\fC#include <qurloperator.h>\fR.PPInherits QObject and QUrl..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQUrlOperator\fR ()".br.ti -1c.BI "\fBQUrlOperator\fR ( const QString & url )".br.ti -1c.BI "\fBQUrlOperator\fR ( const QUrlOperator & url )".br.ti -1c.BI "\fBQUrlOperator\fR ( const QUrlOperator & url, const QString & relUrl, bool checkSlash = FALSE )".br.ti -1c.BI "virtual \fB~QUrlOperator\fR ()".br.ti -1c.BI "virtual const QNetworkOperation * \fBlistChildren\fR ()".br.ti -1c.BI "virtual const QNetworkOperation * \fBmkdir\fR ( const QString & dirname )".br.ti -1c.BI "virtual const QNetworkOperation * \fBremove\fR ( const QString & filename )".br.ti -1c.BI "virtual const QNetworkOperation * \fBrename\fR ( const QString & oldname, const QString & newname )".br.ti -1c.BI "virtual const QNetworkOperation * \fBget\fR ( const QString & location = QString::null )".br.ti -1c.BI "virtual const QNetworkOperation * \fBput\fR ( const QByteArray & data, const QString & location = QString::null )".br.ti -1c.BI "virtual QPtrList<QNetworkOperation> \fBcopy\fR ( const QString & from, const QString & to, bool move = FALSE, bool toPath = TRUE )".br.ti -1c.BI "virtual void \fBcopy\fR ( const QStringList & files, const QString & dest, bool move = FALSE )".br.ti -1c.BI "virtual bool \fBisDir\fR ( bool * ok = 0 )".br.ti -1c.BI "virtual void \fBsetNameFilter\fR ( const QString & nameFilter )".br.ti -1c.BI "QString \fBnameFilter\fR () const".br.ti -1c.BI "virtual QUrlInfo \fBinfo\fR ( const QString & entry ) const".br.ti -1c.BI "virtual void \fBstop\fR ()".br.in -1c.SS "Signals".in +1c.ti -1c.BI "void \fBnewChildren\fR ( const QValueList<QUrlInfo> & i, QNetworkOperation * op )".br.ti -1c.BI "void \fBfinished\fR ( QNetworkOperation * op )".br.ti -1c.BI "void \fBstart\fR ( QNetworkOperation * op )".br.ti -1c.BI "void \fBcreatedDirectory\fR ( const QUrlInfo & i, QNetworkOperation * op )".br.ti -1c.BI "void \fBremoved\fR ( QNetworkOperation * op )".br.ti -1c.BI "void \fBitemChanged\fR ( QNetworkOperation * op )".br.ti -1c.BI "void \fBdata\fR ( const QByteArray & data, QNetworkOperation * op )".br.ti -1c.BI "void \fBdataTransferProgress\fR ( int bytesDone, int bytesTotal, QNetworkOperation * op )".br.ti -1c.BI "void \fBstartedNextCopy\fR ( const QPtrList<QNetworkOperation> & lst )".br.ti -1c.BI "void \fBconnectionStateChanged\fR ( int state, const QString & data )".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBclearEntries\fR ()".br.ti -1c.BI "void \fBgetNetworkProtocol\fR ()".br.ti -1c.BI "void \fBdeleteNetworkProtocol\fR ()".br.in -1c.SH RELATED FUNCTION DOCUMENTATION.in +1c.ti -1c.BI "void \fBqInitNetworkProtocols\fR ()".br.in -1c.SH DESCRIPTIONThe QUrlOperator class provides common operations on URLs..PPThis class operates on hierarchical structures (such as filesystems) using URLs. Its API facilitates all the common operations: <center>.nf.TSl - l. Operation Function List files listChildren() Make a directory mkdir() Remove a file remove() Rename a file rename() Get a file get() Put a file put() Copy a file.TE.fi</center>.PPYou can obtain additional information about the URL with isDir() and info(). If a directory is to be traversed using listChildren(), a name filter can be set with setNameFilter()..PPA QUrlOperator can be used like this, for example to download a file (and assuming that the FTP protocol is registered):.PP.nf.br    QUrlOperator *op = new QUrlOperator();.br    op->copy( QString("ftp://ftp.trolltech.com/qt/source/qt-2.1.0.tar.gz"),.br             "file:/tmp" );.br.fi.PPIf you want to be notified about success/failure, progress, etc., you can connect to QUrlOperator's signals, e.g. to start(), newChildren(), createdDirectory(), removed(), data(), dataTransferProgress(), startedNextCopy(), connectionStateChanged(), finished(), etc. A network operation can be stopped with stop()..PPThe class uses the functionality of registered network protocols to perform these operations. Depending of the protocol of the URL, it uses an appropriate network protocol class for the operations. Each of the operation functions of QUrlOperator creates a QNetworkOperation object that describes the operation and puts it into the operation queue for the network protocol used. If no suitable protocol could be found (because no implementation of the necessary network protocol is registered), the URL operator emits errors. Not every protocol supports every operation, but error handling deals with this problem..PPTo register the available network protocols, use the qInitNetworkProtocols() function. The protocols currently supported are:.TPFTP,.TPHTTP,.TPlocal file system..PPFor more information about the Qt Network Architecture see the Qt Network Documentation..PPSee also QNetworkProtocol, QNetworkOperation, Input/Output and Networking, and Miscellaneous Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QUrlOperator::QUrlOperator ()"Constructs a QUrlOperator with an empty (i.e. invalid) URL..SH "QUrlOperator::QUrlOperator ( const QString & url )"Constructs a QUrlOperator using \fIurl\fR and parses this string..PPIf you pass strings like "/home/qt" the "file" protocol is assumed..SH "QUrlOperator::QUrlOperator ( const QUrlOperator & url )"Constructs a copy of \fIurl\fR..SH "QUrlOperator::QUrlOperator ( const QUrlOperator & url, const QString & relUrl, bool checkSlash = FALSE )"Constructs a QUrlOperator. The URL on which this QUrlOperator operates is constructed out of the arguments \fIurl\fR, \fIrelUrl\fR and \fIcheckSlash\fR: see the corresponding QUrl constructor for an explanation of these arguments..SH "QUrlOperator::~QUrlOperator ()\fC [virtual]\fR"Destructor..SH "void QUrlOperator::clearEntries ()\fC [virtual protected]\fR"Clears the cache of children..SH "void QUrlOperator::connectionStateChanged ( int state, const QString & data )\fC [signal]\fR"This signal is emitted whenever the URL operator's connection state changes. \fIstate\fR describes the new state, which is a QNetworkProtocol::ConnectionState value..PP\fIdata\fR is a string that describes the change of the connection. This can be used to display a message to the user..SH "QPtrList<QNetworkOperation> QUrlOperator::copy ( const QString & from, const QString & to, bool move = FALSE, bool toPath = TRUE )\fC [virtual]\fR"Copies the file \fIfrom\fR to \fIto\fR. If \fImove\fR is TRUE, the file is moved (copied and removed). \fIfrom\fR must point to a file and \fIto\fR must point to a directory (into which \fIfrom\fR is copied) unless \fItoPath\fR is set to FALSE. If \fItoPath\fR is set to FALSE then the \fIto\fR variable is assumed to be the absolute file path (destination file path + file name). The copying is done using the get() and put() operations. If you want to be notified about the progress of the operation, connect to the dataTransferProgress() signal. Bear in mind that the get() and put() operations emit this signal through the QUrlOperator. The number of transferred bytes and the total bytes that you receive as arguments in this signal do not relate to the the whole copy operation; they relate first to the get() and then to the put() operation. Always check what type of operation the signal comes from; this is given in the signal's last argument..PPAt the end, finished() (with success or failure) is emitted, so check the state of the network operation object to see whether or not the operation was successful..PPBecause a move or copy operation consists of multiple operations (get(), put() and maybe remove()), this function doesn't return a single QNetworkOperation, but rather a list of them. They are in the order: get(), put() and (if applicable) remove()..PPSee also get() and put()..SH "void QUrlOperator::copy ( const QStringList & files, const QString & dest, bool move = FALSE )\fC [virtual]\fR"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -