diff options
author | Timothy Pearson <[email protected]> | 2013-11-06 16:23:17 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-11-06 16:23:17 -0600 |
commit | e193e0140419d117a52e3756ddd9d2bdf3ab7a4a (patch) | |
tree | 2581a958653985ed91ff63ff702ad47a253553b3 /doc/man/man3/tqmimesourcefactory.3qt | |
parent | ab9c0372a33806de1210b9b6f3bc7544895ad4fb (diff) | |
download | tqt3-e193e0140419d117a52e3756ddd9d2bdf3ab7a4a.tar.gz tqt3-e193e0140419d117a52e3756ddd9d2bdf3ab7a4a.zip |
Automated update from Qt3
Diffstat (limited to 'doc/man/man3/tqmimesourcefactory.3qt')
-rw-r--r-- | doc/man/man3/tqmimesourcefactory.3qt | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/doc/man/man3/tqmimesourcefactory.3qt b/doc/man/man3/tqmimesourcefactory.3qt new file mode 100644 index 000000000..063c849c2 --- /dev/null +++ b/doc/man/man3/tqmimesourcefactory.3qt @@ -0,0 +1,233 @@ +'\" t +.TH QMimeSourceFactory 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the +.\" license file included in the distribution for a complete license +.\" statement. +.\" +.ad l +.nh +.SH NAME +QMimeSourceFactory \- Extensible provider of mime-typed data +.SH SYNOPSIS +\fC#include <ntqmime.h>\fR +.PP +.SS "Public Members" +.in +1c +.ti -1c +.BI "\fBQMimeSourceFactory\fR ()" +.br +.ti -1c +.BI "virtual \fB~QMimeSourceFactory\fR ()" +.br +.ti -1c +.BI "virtual const QMimeSource * \fBdata\fR ( const QString & abs_name ) const" +.br +.ti -1c +.BI "virtual QString \fBmakeAbsolute\fR ( const QString & abs_or_rel_name, const QString & context ) const" +.br +.ti -1c +.BI "const QMimeSource * \fBdata\fR ( const QString & abs_or_rel_name, const QString & context ) const" +.br +.ti -1c +.BI "virtual void \fBsetText\fR ( const QString & abs_name, const QString & text )" +.br +.ti -1c +.BI "virtual void \fBsetImage\fR ( const QString & abs_name, const QImage & image )" +.br +.ti -1c +.BI "virtual void \fBsetPixmap\fR ( const QString & abs_name, const QPixmap & pixmap )" +.br +.ti -1c +.BI "virtual void \fBsetData\fR ( const QString & abs_name, QMimeSource * data )" +.br +.ti -1c +.BI "virtual void \fBsetFilePath\fR ( const QStringList & path )" +.br +.ti -1c +.BI "virtual QStringList \fBfilePath\fR () const" +.br +.ti -1c +.BI "void \fBaddFilePath\fR ( const QString & p )" +.br +.ti -1c +.BI "virtual void \fBsetExtensionType\fR ( const QString & ext, const char * mimetype )" +.br +.in -1c +.SS "Static Public Members" +.in +1c +.ti -1c +.BI "QMimeSourceFactory * \fBdefaultFactory\fR ()" +.br +.ti -1c +.BI "void \fBsetDefaultFactory\fR ( QMimeSourceFactory * factory )" +.br +.ti -1c +.BI "QMimeSourceFactory * \fBtakeDefaultFactory\fR ()" +.br +.ti -1c +.BI "void \fBaddFactory\fR ( QMimeSourceFactory * f )" +.br +.ti -1c +.BI "void \fBremoveFactory\fR ( QMimeSourceFactory * f )" +.br +.in -1c +.SH DESCRIPTION +The QMimeSourceFactory class is an extensible provider of mime-typed data. +.PP +A QMimeSourceFactory provides an abstract interface to a collection of information. Each piece of information is represented by a QMimeSource object which can be examined and converted to concrete data types by functions such as QImageDrag::canDecode() and QImageDrag::decode(). +.PP +The base QMimeSourceFactory can be used in two ways: as an abstraction of a collection of files or as specifically stored data. For it to access files, call setFilePath() before accessing data. For stored data, call setData() for each item (there are also convenience functions, e.g. setText(), setImage() and setPixmap(), that simply call setData() with appropriate parameters). +.PP +The rich text widgets, QTextEdit and QTextBrowser, use QMimeSourceFactory to resolve references such as images or links within rich text documents. They either access the default factory (see defaultFactory()) or their own (see QTextEdit::setMimeSourceFactory()). Other classes that are capable of displaying rich text (such as QLabel, QWhatsThis or QMessageBox) always use the default factory. +.PP +A factory can also be used as a container to store data associated with a name. This technique is useful whenever rich text contains images that are stored in the program itself, not loaded from the hard disk. Your program may, for example, define some image data as: +.PP +.nf +.br + static const char* myimage_data[]={ +.br + "...", +.br + ... +.br + "..."}; +.br +.fi +.PP +To be able to use this image within some rich text, for example inside a QLabel, you must create a QImage from the raw data and insert it into the factory with a unique name: +.PP +.nf +.br + QMimeSourceFactory::defaultFactory()->setImage( "myimage", QImage(myimage_data) ); +.br +.fi +.PP +Now you can create a rich text QLabel with +.PP +.nf +.br + QLabel* label = new QLabel( +.br + "Rich text with embedded image:<img source=\\"myimage\\">" +.br + "Isn't that <em>cute</em>?" ); +.br +.fi +.PP +When no longer needed, you can clear the data from the factory: +.PP +.nf +.br + delete label; +.br + QMimeSourceFactory::defaultFactory()->setData( "myimage", 0 ); +.br +.fi +.PP +See also Environment Classes and Input/Output and Networking. +.SH MEMBER FUNCTION DOCUMENTATION +.SH "QMimeSourceFactory::QMimeSourceFactory ()" +Constructs a QMimeSourceFactory that has no file path and no stored content. +.SH "QMimeSourceFactory::~QMimeSourceFactory ()\fC [virtual]\fR" +Destroys the QMimeSourceFactory, deleting all stored content. +.SH "void QMimeSourceFactory::addFactory ( QMimeSourceFactory * f )\fC [static]\fR" +Adds the QMimeSourceFactory \fIf\fR to the list of available mimesource factories. If the defaultFactory() can't resolve a data() it iterates over the list of installed mimesource factories until the data can be resolved. +.PP +See also removeFactory(). +.SH "void QMimeSourceFactory::addFilePath ( const QString & p )" +Adds another search path, \fIp\fR to the existing search paths. +.PP +See also setFilePath(). +.SH "const QMimeSource * QMimeSourceFactory::data ( const QString & abs_name ) const\fC [virtual]\fR" +Returns a reference to the data associated with \fIabs_name\fR. The return value remains valid only until the next data() or setData() call, so you should immediately decode the result. +.PP +If there is no data associated with \fIabs_name\fR in the factory's store, the factory tries to access the local filesystem. If \fIabs_name\fR isn't an absolute file name, the factory will search for it in all defined paths (see setFilePath()). +.PP +The factory understands all the image formats supported by QImageIO. Any other mime types are determined by the file name extension. The default settings are +.PP +.nf +.br + setExtensionType("html", "text/html;charset=iso8859-1"); +.br + setExtensionType("htm", "text/html;charset=iso8859-1"); +.br + setExtensionType("txt", "text/plain"); +.br + setExtensionType("xml", "text/xml;charset=UTF-8"); +.br +.fi +The effect of these is that file names ending in "txt" will be treated as text encoded in the local encoding; those ending in" xml" will be treated as text encoded in Unicode UTF-8 encoding. The text/html type is treated specially, since the encoding can be specified in the html file itself. "html" or "htm" will be treated as text encoded in the encoding specified by the html meta tag, if none could be found, the charset of the mime type will be used. The text subtype ("html", "plain", or "xml") does not affect the factory, but users of the factory may behave differently. We recommend creating "xml" files where practical. These files can be viewed regardless of the runtime encoding and can encode any Unicode characters without resorting to encoding definitions inside the file. +.PP +Any file data that is not recognized will be retrieved as a QMimeSource providing the "application/octet-stream" mime type, meaning uninterpreted binary data. +.PP +You can add further extensions or change existing ones with subsequent calls to setExtensionType(). If the extension mechanism is not sufficient for your problem domain, you can inherit QMimeSourceFactory and reimplement this function to perform some more specialized mime-type detection. The same applies if you want to use the mime source factory to access URL referenced data over a network. +.SH "const QMimeSource * QMimeSourceFactory::data ( const QString & abs_or_rel_name, const QString & context ) const" +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +.PP +A convenience function. See data(const QString& abs_name). The file name is given in \fIabs_or_rel_name\fR and the path is in \fIcontext\fR. +.SH "QMimeSourceFactory * QMimeSourceFactory::defaultFactory ()\fC [static]\fR" +Returns the application-wide default mime source factory. This factory is used by rich text rendering classes such as QSimpleRichText, QWhatsThis and QMessageBox to resolve named references within rich text documents. It serves also as the initial factory for the more complex render widgets, QTextEdit and QTextBrowser. +.PP +See also setDefaultFactory(). +.PP +Examples: +.)l action/application.cpp and application/application.cpp. +.SH "QStringList QMimeSourceFactory::filePath () const\fC [virtual]\fR" +Returns the currently set search paths. +.SH "QString QMimeSourceFactory::makeAbsolute ( const QString & abs_or_rel_name, const QString & context ) const\fC [virtual]\fR" +Converts the absolute or relative data item name \fIabs_or_rel_name\fR to an absolute name, interpreted within the context (path) of the data item named \fIcontext\fR (this must be an absolute name). +.SH "void QMimeSourceFactory::removeFactory ( QMimeSourceFactory * f )\fC [static]\fR" +Removes the mimesource factory \fIf\fR from the list of available mimesource factories. +.PP +See also addFactory(). +.SH "void QMimeSourceFactory::setData ( const QString & abs_name, QMimeSource * data )\fC [virtual]\fR" +Sets \fIdata\fR to be the data item associated with the absolute name \fIabs_name\fR. Note that the ownership of \fIdata\fR is transferred to the factory: do not delete or access the pointer after passing it to this function. +.PP +Passing 0 for data removes previously stored data. +.SH "void QMimeSourceFactory::setDefaultFactory ( QMimeSourceFactory * factory )\fC [static]\fR" +Sets the default \fIfactory\fR, destroying any previously set mime source provider. The ownership of the factory is transferred to Qt. +.PP +See also defaultFactory(). +.SH "void QMimeSourceFactory::setExtensionType ( const QString & ext, const char * mimetype )\fC [virtual]\fR" +Sets the mime-type to be associated with the file name extension, \fIext\fR to \fImimetype\fR. This determines the mime-type for files found via the paths set by setFilePath(). +.SH "void QMimeSourceFactory::setFilePath ( const QStringList & path )\fC [virtual]\fR" +Sets the list of directories that will be searched when named data is requested to the those given in the string list \fIpath\fR. +.PP +See also filePath(). +.SH "void QMimeSourceFactory::setImage ( const QString & abs_name, const QImage & image )\fC [virtual]\fR" +Sets \fIimage\fR to be the data item associated with the absolute name \fIabs_name\fR. +.PP +Equivalent to setData(abs_name, new QImageDrag(image)). +.SH "void QMimeSourceFactory::setPixmap ( const QString & abs_name, const QPixmap & pixmap )\fC [virtual]\fR" +Sets \fIpixmap\fR to be the data item associated with the absolute name \fIabs_name\fR. +.SH "void QMimeSourceFactory::setText ( const QString & abs_name, const QString & text )\fC [virtual]\fR" +Sets \fItext\fR to be the data item associated with the absolute name \fIabs_name\fR. +.PP +Equivalent to setData(abs_name, new QTextDrag(text)). +.SH "QMimeSourceFactory * QMimeSourceFactory::takeDefaultFactory ()\fC [static]\fR" +Sets the defaultFactory() to 0 and returns the previous one. + +.SH "SEE ALSO" +.BR http://doc.trolltech.com/qmimesourcefactory.html +.BR http://www.trolltech.com/faq/tech.html +.SH COPYRIGHT +Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the +license file included in the distribution for a complete license +statement. +.SH AUTHOR +Generated automatically from the source code. +.SH BUGS +If you find a bug in Qt, please report it as described in +.BR http://doc.trolltech.com/bughowto.html . +Good bug reports help us to help you. Thank you. +.P +The definitive Qt documentation is provided in HTML format; it is +located at $QTDIR/doc/html and can be read using Qt Assistant or with +a web browser. This man page is provided as a convenience for those +users who prefer man pages, although this format is not officially +supported by Trolltech. +.P +If you find errors in this manual page, please report them to +.BR [email protected] . +Please include the name of the manual page (tqmimesourcefactory.3qt) and the Qt +version (3.3.8). |