From 1209fccaf7c78f46f7d30cf729ed34e12e295e62 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 11 Feb 2012 02:13:22 +0100 Subject: QMimeData: export URLs as text too This allows to drop or paste them into lineedits and text widgets (including such widgets in non-Qt applications) Implementation note: this is done on-demand rather than in setUrls so that it's still possible to setText explicitely; the new code is only a fallback for when no text/plain data is available. Change-Id: Ie90c43a30bfa64a6047b627e7351d20bf5ec8e03 Reviewed-by: Lars Knoll --- tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp index 09f17602b3..f9a6bae087 100644 --- a/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp +++ b/tests/auto/corelib/kernel/qmimedata/tst_qmimedata.cpp @@ -317,19 +317,22 @@ void tst_QMimeData::setUrls() const longUrlList += QUrl("http://www.google.com"); // verify initial state - QVERIFY(mimeData.hasUrls() == false); + QCOMPARE(mimeData.hasUrls(), false); // set a few, verify mimeData.setUrls(shortUrlList); QCOMPARE(mimeData.urls(), shortUrlList); + QCOMPARE(mimeData.text(), QString("http://qt.nokia.com")); // change them, verify mimeData.setUrls(longUrlList); QCOMPARE(mimeData.urls(), longUrlList); + QCOMPARE(mimeData.text(), QString("http://qt.nokia.com\nhttp://www.google.com\n")); // clear, verify mimeData.clear(); - QVERIFY(mimeData.hasUrls() == false); + QCOMPARE(mimeData.hasUrls(), false); + QCOMPARE(mimeData.hasText(), false); } QTEST_MAIN(tst_QMimeData) -- cgit v1.2.3