Qt 4.8
Public Functions | List of all members
QMimeSource Class Referenceabstract

The QMimeSource class is an abstraction of objects that provided formatted data of a certain MIME type. More...

#include <qmime.h>

Inheritance diagram for QMimeSource:
QDropEvent QMimeDataWrapper QDragMoveEvent QDragEnterEvent

Public Functions

virtual QByteArray encodedData (const char *) const =0
 Returns the encoded data of this object in the specified MIME format. More...
 
virtual const char * format (int n=0) const =0
 Returns the (i - 1)-th supported MIME format, or 0. More...
 
virtual bool provides (const char *) const
 Returns true if the object can provide the data in format mimeType; otherwise returns false. More...
 
virtual ~QMimeSource ()
 Destroys the MIME source. More...
 

Detailed Description

The QMimeSource class is an abstraction of objects that provided formatted data of a certain MIME type.

The preferred approach to drag and drop is to use QDrag in conjunction with QMimeData. See Drag and Drop for details.

See also
QMimeData, QDrag

Definition at line 53 of file qmime.h.

Constructors and Destructors

◆ ~QMimeSource()

QMimeSource::~QMimeSource ( )
virtual

Destroys the MIME source.

Definition at line 65 of file qmime.cpp.

66 {
67 }

Functions

◆ encodedData()

QByteArray QMimeSource::encodedData ( const char *  format) const
pure virtual

Returns the encoded data of this object in the specified MIME format.

Implemented in QDropEvent, and QMimeDataWrapper.

Referenced by QMimeSourceWrapper::retrieveData().

◆ format()

const char * QMimeSource::format ( int  n = 0) const
pure virtual

Returns the (i - 1)-th supported MIME format, or 0.

Implemented in QDropEvent, and QMimeDataWrapper.

Referenced by QMimeSourceWrapper::formats(), and provides().

◆ provides()

bool QMimeSource::provides ( const char *  mimeType) const
virtual

Returns true if the object can provide the data in format mimeType; otherwise returns false.

If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as QTextDrag::canDecode() and QImageDrag::canDecode().

Reimplemented in QDropEvent.

Definition at line 90 of file qmime.cpp.

Referenced by QMimeSourceWrapper::hasFormat().

91 {
92  const char* fmt;
93  for (int i=0; (fmt = format(i)); i++) {
94  if (!qstricmp(mimeType,fmt))
95  return true;
96  }
97  return false;
98 }
virtual const char * format(int n=0) const =0
Returns the (i - 1)-th supported MIME format, or 0.
Q_CORE_EXPORT int qstricmp(const char *, const char *)

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