diff options
-rw-r--r-- | examples/widgets/draganddrop/dropsite/droparea.cpp | 3 | ||||
-rw-r--r-- | examples/widgets/draganddrop/dropsite/dropsitewindow.cpp | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/examples/widgets/draganddrop/dropsite/droparea.cpp b/examples/widgets/draganddrop/dropsite/droparea.cpp index 886bfd6890..19644ed573 100644 --- a/examples/widgets/draganddrop/dropsite/droparea.cpp +++ b/examples/widgets/draganddrop/dropsite/droparea.cpp @@ -93,6 +93,9 @@ void DropArea::dropEvent(QDropEvent *event) //! [dropEvent() function part2] if (mimeData->hasImage()) { setPixmap(qvariant_cast<QPixmap>(mimeData->imageData())); + } else if (mimeData->hasFormat(QLatin1String("text/markdown"))) { + setText(QString::fromUtf8(mimeData->data(QLatin1String("text/markdown")))); + setTextFormat(Qt::MarkdownText); } else if (mimeData->hasHtml()) { setText(mimeData->html()); setTextFormat(Qt::RichText); diff --git a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp index a937e24a4c..d96ebce2e3 100644 --- a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp +++ b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp @@ -132,6 +132,8 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData) QString text; if (format == QLatin1String("text/plain")) { text = mimeData->text().simplified(); + } else if (format == QLatin1String("text/markdown")) { + text = QString::fromUtf8(mimeData->data(QLatin1String("text/markdown"))); } else if (format == QLatin1String("text/html")) { text = mimeData->html().simplified(); } else if (format == QLatin1String("text/uri-list")) { |