本文整理汇总了C++中QMimeData::imageData方法的典型用法代码示例。如果您正苦于以下问题:C++ QMimeData::imageData方法的具体用法?C++ QMimeData::imageData怎么用?C++ QMimeData::imageData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMimeData
的用法示例。
在下文中一共展示了QMimeData::imageData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: imageData
void tst_QMimeData::imageData() const
{
QMimeData mimeData;
// initial state
QCOMPARE(mimeData.imageData(), QVariant());
// set, test
mimeData.setImageData(QImage());
QVERIFY(mimeData.hasImage());
QCOMPARE(mimeData.imageData(), QVariant(QImage()));
// clear, verify
mimeData.clear();
QCOMPARE(mimeData.imageData(), QVariant());
}
示例2: startDrag
void DragClientQt::startDrag(DragImageRef dragImage, const IntPoint& dragImageOrigin, const IntPoint& eventPos, Clipboard* clipboard, Frame* frame, bool)
{
#ifndef QT_NO_DRAGANDDROP
QMimeData* clipboardData = clipboard->pasteboard().clipboardData();
clipboard->pasteboard().invalidateWritableData();
PlatformPageClient pageClient = m_chromeClient->platformPageClient();
QObject* view = pageClient ? pageClient->ownerWidget() : 0;
if (view) {
QDrag* drag = new QDrag(view);
if (dragImage) {
drag->setPixmap(*dragImage);
drag->setHotSpot(IntPoint(eventPos - dragImageOrigin));
} else if (clipboardData && clipboardData->hasImage())
drag->setPixmap(qvariant_cast<QPixmap>(clipboardData->imageData()));
DragOperation dragOperationMask = clipboard->sourceOperation();
drag->setMimeData(clipboardData);
Qt::DropAction actualDropAction = drag->exec(dragOperationsToDropActions(dragOperationMask));
// Send dragEnd event
PlatformMouseEvent me(m_chromeClient->screenToRootView(QCursor::pos()), QCursor::pos(), LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0);
frame->eventHandler()->dragSourceEndedAt(me, dropActionToDragOperation(actualDropAction));
}
frame->page()->dragController()->dragEnded();
#endif
}
示例3:
QDebug operator<<(QDebug d, const QMimeData &m)
{
QDebug nospace = d.nospace();
const QStringList formats = m.formats();
nospace << "QMimeData: " << formats.join(QStringLiteral(", ")) << '\n'
<< " Text=" << m.hasText() << " HTML=" << m.hasHtml()
<< " Color=" << m.hasColor() << " Image=" << m.hasImage()
<< " URLs=" << m.hasUrls() << '\n';
if (m.hasText())
nospace << " Text: '" << m.text() << "'\n";
if (m.hasHtml())
nospace << " HTML: '" << m.html() << "'\n";
if (m.hasColor())
nospace << " Color: " << qvariant_cast<QColor>(m.colorData()) << '\n';
if (m.hasImage())
nospace << " Image: " << qvariant_cast<QImage>(m.imageData()).size() << '\n';
if (m.hasUrls())
nospace << " URLs: " << m.urls() << '\n';
return d;
}