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

QVariant QMimeData::imageData (  )  const

Returns a QVariant storing a QImage if the object can return an image; otherwise returns a null variant.

A QVariant is used because QMimeData belongs to the QtCore library, whereas QImage belongs to QtGui. To convert the QVariant to a QImage, simply use qvariant_cast(). For example:

        if (event->mimeData()->hasImage()) {
            QImage image = qvariant_cast<QImage>(event->mimeData()->imageData());
            ...
        }

See also:
hasImage()

Definition at line 417 of file qmimedata.cpp.

Referenced by QClipboard::image(), and QClipboard::pixmap().

{
    Q_D(const QMimeData);
    return d->retrieveTypedData(QLatin1String("application/x-qt-image"), QVariant::Image);
}


Generated by  Doxygen 1.6.0   Back to index