Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | Friends | Related Functions

QMimeData Class Reference

The QMimeData class provides a container for data that records information about its MIME type. More...

Inheritance diagram for QMimeData:
Inheritance graph
[legend]
Collaboration diagram for QMimeData:
Collaboration graph
[legend]

List of all members.

Public Slots

void deleteLater ()

Signals

void destroyed (QObject *=0)

Public Member Functions

bool blockSignals (bool b)
const QObjectListchildren () const
void clear ()
QVariant colorData () const
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
QByteArray data (const QString &mimetype) const
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
bool disconnect (const QObject *receiver, const char *member=0)
void dumpObjectInfo ()
void dumpObjectTree ()
QList< QByteArraydynamicPropertyNames () const
virtual bool event (QEvent *)
virtual bool eventFilter (QObject *, QEvent *)
template<typename T >
findChild (const QString &aName=QString()) const
template<typename T >
QList< T > findChildren (const QRegExp &re) const
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
virtual QStringList formats () const
bool hasColor () const
virtual bool hasFormat (const QString &mimetype) const
bool hasHtml () const
bool hasImage () const
bool hasText () const
bool hasUrls () const
QString html () const
QVariant imageData () const
bool inherits (const char *classname) const
void installEventFilter (QObject *)
bool isWidgetType () const
void killTimer (int id)
void moveToThread (QThread *thread)
QString objectName () const
QObjectparent () const
QVariant property (const char *name) const
 QMimeData ()
void removeEventFilter (QObject *)
void removeFormat (const QString &mimetype)
void setColorData (const QVariant &color)
void setData (const QString &mimetype, const QByteArray &data)
void setHtml (const QString &html)
void setImageData (const QVariant &image)
void setObjectName (const QString &name)
void setParent (QObject *)
bool setProperty (const char *name, const QVariant &value)
void setText (const QString &text)
void setUrls (const QList< QUrl > &urls)
void setUserData (uint id, QObjectUserData *data)
bool signalsBlocked () const
int startTimer (int interval)
QString text () const
QThreadthread () const
QList< QUrlurls () const
QObjectUserDatauserData (uint id) const
 ~QMimeData ()

Static Public Member Functions

static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
static uint registerUserData ()

Protected Member Functions

virtual void childEvent (QChildEvent *)
virtual void connectNotify (const char *signal)
virtual void customEvent (QEvent *)
virtual void disconnectNotify (const char *signal)
int receivers (const char *signal) const
virtual QVariant retrieveData (const QString &mimetype, QVariant::Type preferredType) const
QObjectsender () const
virtual void timerEvent (QTimerEvent *)

Protected Attributes

QObjectDatad_ptr

Static Protected Attributes

static const QMetaObject staticQtMetaObject

Properties

QString objectName
 the name of this object

Friends

class QApplication
class QApplicationPrivate
class QCoreApplication
class QCoreApplicationPrivate
struct QMetaObject
class QThreadData
class QWidget

Related Functions

(Note that these are not member functions.)


qFindChild (const QObject *obj, const QString &name)
qFindChildqFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)()
QList< T > qFindChildren (const QObject *obj, const QString &name)
QList< T > qFindChildrenqFindChildren (const QObject *obj, const QRegExp &regExp)()
QList< T > qFindChildrenqFindChildren (const QObject *obj, const QString &name=QString(), T dummy=0)()
T * qobject_cast (QObject *object)
 QObjectList
void * qt_find_obj_child (QObject *parent, const char *type, const QString &name)

Detailed Description

The QMimeData class provides a container for data that records information about its MIME type.

QMimeData is used to describe information that can be stored in the {QClipboard}{clipboard}, and transferred via the {drag and drop} mechanism. QMimeData objects associate the data that they hold with the corresponding MIME types to ensure that information can be safely transferred between applications, and copied around within the same application.

QMimeData objects are usually created using new and supplied to QDrag or QClipboard objects. This is to enable Qt to manage the memory that they use.

A single QMimeData object can store the same data using several different formats at the same time. The formats() function returns a list of the available formats in order of preference. The data() function returns the raw data associated with a MIME type, and setData() allows you to set the data for a MIME type.

For the most common MIME types, QMimeData provides convenience functions to access the data:

Tester Getter Setter MIME Types hasText() text() setText() text/plain hasHtml() html() setHtml() text/html hasUrls() urls() setUrls() text/uri-list hasImage() imageData() setImageData() image/ * hasColor() colorData() setColorData() application/x-color

For example, if your write a widget that accepts URL drags, you would end up writing code like this:

doc/src/snippets/code/src_corelib_kernel_qmimedata.cpp 0

There are three approaches for storing custom data in a QMimeData object:

1 Custom data can be stored directly in a QMimeData object as a QByteArray using setData(). For example:

doc/src/snippets/code/src_corelib_kernel_qmimedata.cpp 1

We can subclass QMimeData and reimplement hasFormat(), formats(), and retrieveData().

If the drag and drop operation occurs withing a single application, we can subclass QMimeData and add extra data in it, and use a qobject_cast() in the receiver's drop event handler. For example:

doc/src/snippets/code/src_corelib_kernel_qmimedata.cpp 2

Definition at line 57 of file qmimedata.h.


The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index