diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-07 00:53:30 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-07 00:53:30 (GMT) |
commit | e688fc73578ead8c73aaac8cb73f47a23edb7038 (patch) | |
tree | 8ba30142f3d84d6470aaeb58e6e1c1dc49827fce | |
parent | 5b67b61150771cf978648a35db201345d6fb37ae (diff) | |
parent | f737f2c9140e49d77ca2cacef7577c758a34218e (diff) | |
download | Qt-e688fc73578ead8c73aaac8cb73f47a23edb7038.zip Qt-e688fc73578ead8c73aaac8cb73f47a23edb7038.tar.gz Qt-e688fc73578ead8c73aaac8cb73f47a23edb7038.tar.bz2 |
Merge branch 'qtquick11' of scm.dev.nokia.troll.no:qt/qt-qml into qtquick11
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 1 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 16 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit_p.h | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png | bin | 0 -> 609 bytes | |||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png | bin | 0 -> 677 bytes | |||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml | 191 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png | bin | 0 -> 609 bytes | |||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png | bin | 0 -> 677 bytes | |||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml | 191 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml | 15 |
10 files changed, 412 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index f06b256..5e04168 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -142,6 +142,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QGraphicsScale>("QtQuick",1,0,"Scale"); qmlRegisterType<QDeclarativeText>("QtQuick",1,0,"Text"); qmlRegisterType<QDeclarativeTextEdit>("QtQuick",1,0,"TextEdit"); + qmlRegisterType<QDeclarativeTextEdit,1>("QtQuick",1,1,"TextEdit"); #ifndef QT_NO_LINEEDIT qmlRegisterType<QDeclarativeTextInput>("QtQuick",1,0,"TextInput"); #endif diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index b76a70c..6a51a3c 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -103,6 +103,14 @@ TextEdit { \sa Text, TextInput, {declarative/text/textselection}{Text Selection example} */ +/*! + \qmlsignal TextEdit::onLinkActivated(string link) + \since Quick 1.1 + + This handler is called when the user clicks on a link embedded in the text. + The link must be in rich text or HTML format and the + \a link string provides access to the particular link. +*/ QDeclarativeTextEdit::QDeclarativeTextEdit(QDeclarativeItem *parent) : QDeclarativePaintedItem(*(new QDeclarativeTextEditPrivate), parent) { @@ -896,11 +904,11 @@ void QDeclarativeTextEdit::setReadOnly(bool r) return; - Qt::TextInteractionFlags flags = Qt::NoTextInteraction; + Qt::TextInteractionFlags flags = Qt::LinksAccessibleByMouse; if (r) { - flags = Qt::TextSelectableByMouse; + flags = flags | Qt::TextSelectableByMouse; } else { - flags = Qt::TextEditorInteraction; + flags = flags | Qt::TextEditorInteraction; } d->control->setTextInteractionFlags(flags); if (!r) @@ -1262,6 +1270,7 @@ void QDeclarativeTextEditPrivate::init() control = new QTextControl(q); control->setIgnoreUnusedNavigationEvents(true); + control->setTextInteractionFlags(control->textInteractionFlags() | Qt::LinksAccessibleByMouse); // QTextControl follows the default text color // defined by the platform, declarative text @@ -1280,6 +1289,7 @@ void QDeclarativeTextEditPrivate::init() QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged())); QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged())); + QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString))); document = control->document(); document->setDefaultFont(font); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 691d995..37b24f7 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -221,6 +221,7 @@ Q_SIGNALS: void persistentSelectionChanged(bool isPersistentSelection); void textMarginChanged(qreal textMargin); void selectByMouseChanged(bool selectByMouse); + Q_REVISION(1) void linkActivated(const QString &link); public Q_SLOTS: void deselect(); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png Binary files differnew file mode 100644 index 0000000..7d0d0ae --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.0.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png Binary files differnew file mode 100644 index 0000000..7d612bf --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.1.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml new file mode 100644 index 0000000..8c7e380 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data-X11/linkActivated.qml @@ -0,0 +1,191 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "linkActivated.0.png" + } + Frame { + msec: 32 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 48 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 64 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 80 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 96 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 112 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 128 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 144 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 160 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 176 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 192 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 208 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 224 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 240 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 256 + hash: "53d97d0966197ea41364511dea13752f" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 21; y: 13 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 272 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 288 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 304 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 22; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 320 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 336 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 352 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 368 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 384 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 400 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 416 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 432 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 448 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 464 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 480 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 496 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 512 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 528 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 544 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 560 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 576 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 592 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 608 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png Binary files differnew file mode 100644 index 0000000..7d0d0ae --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.0.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png Binary files differnew file mode 100644 index 0000000..7d612bf --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.1.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml new file mode 100644 index 0000000..8c7e380 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/data/linkActivated.qml @@ -0,0 +1,191 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + image: "linkActivated.0.png" + } + Frame { + msec: 32 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 48 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 64 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 80 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 96 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 112 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 128 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 144 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 160 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 176 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 192 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 208 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 224 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 240 + hash: "53d97d0966197ea41364511dea13752f" + } + Frame { + msec: 256 + hash: "53d97d0966197ea41364511dea13752f" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 21; y: 13 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 272 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 288 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Frame { + msec: 304 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 22; y: 11 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 320 + hash: "9482227cbc77e9083218c1452e8644d8" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 23; y: 10 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 336 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 352 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 368 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 384 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 400 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 416 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 432 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 448 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 464 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 480 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 496 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 512 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 528 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 544 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 560 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 576 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 592 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } + Frame { + msec: 608 + hash: "29c47cec5d015e6cab0762c3db0fa714" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml new file mode 100644 index 0000000..177d475 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/linkActivated.qml @@ -0,0 +1,15 @@ +import QtQuick 1.1 + +Rectangle{ + width: 100 + height: 100 + TextEdit{ + text: '<a href="clicked">Click Me</a> ' + onLinkActivated: txt.text=link; + } + Text{ + id: txt + y:50 + text: "unknown" + } +} |