diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-10-12 05:52:19 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-10-12 05:52:19 (GMT) |
commit | 79c8df2e2e45e2eafa0789da0a84104b604fa0be (patch) | |
tree | 72327aeef55ecc800f492d8f6b51d41ee4b47011 | |
parent | 2dfca66add98481348d67ccdcca7e3bf7b890e0c (diff) | |
parent | e4dbf0c82b46e7a32e21185c8f633506229be944 (diff) | |
download | Qt-79c8df2e2e45e2eafa0789da0a84104b604fa0be.zip Qt-79c8df2e2e45e2eafa0789da0a84104b604fa0be.tar.gz Qt-79c8df2e2e45e2eafa0789da0a84104b604fa0be.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 25 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 6f5608a..e05f4e4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -319,6 +319,7 @@ void QDeclarativeTextEdit::setTextFormat(TextFormat format) updateSize(); } d->format = format; + d->control->setAcceptRichText(d->format != PlainText); emit textFormatChanged(d->format); } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 472c5ef..a7971cc 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -56,6 +56,8 @@ #include <QDir> #include <QStyle> #include <QInputContext> +#include <QClipboard> +#include <QMimeData> #include <private/qapplication_p.h> #include <private/qtextcontrol_p.h> @@ -119,6 +121,8 @@ private slots: void openInputPanelOnClick(); void openInputPanelOnFocus(); void geometrySignals(); + void pastingRichText_QTBUG_14003(); + private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -1174,6 +1178,27 @@ void tst_qdeclarativetextedit::geometrySignals() delete o; } +void tst_qdeclarativetextedit::pastingRichText_QTBUG_14003() +{ +#ifndef QT_NO_CLIPBOARD + QString componentStr = "import QtQuick 1.0\nTextEdit { textFormat: TextEdit.PlainText }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextEdit *obj = qobject_cast<QDeclarativeTextEdit*>(component.create()); + + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText); + + QMimeData *mData = new QMimeData; + mData->setHtml("<font color=\"red\">Hello</font>"); + QApplication::clipboard()->setMimeData(mData); + + obj->paste(); + QTRY_VERIFY(obj->text() == ""); + QTRY_VERIFY(obj->textFormat() == QDeclarativeTextEdit::PlainText); +#endif +} + QTEST_MAIN(tst_qdeclarativetextedit) #include "tst_qdeclarativetextedit.moc" |