diff options
Diffstat (limited to 'src/declarative')
3 files changed, 15 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(); |