diff options
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem.cpp | 48 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitem_p.h | 11 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 3 |
3 files changed, 59 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 6602dda28b..d3132deced 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -449,6 +449,12 @@ void QDeclarativeItemKeyFilter::componentComplete() a chain of items with the same KeyNavigation handler. If multiple items in a row are not enabled or visible, they will also be skipped. + KeyNavigation will implicitly set the other direction to return focus to this item. So if you set + \l left to another item, \l right will be set on that item's KeyNavigation to set focus back to this + item. However, if that item's KeyNavigation has had right explicitly set then no change will occur. + This means that the above example could have been written, with the same behaviour, without specifing + KeyNavigation.right or KeyNavigation.down for any of the items. + \sa {Keys}{Keys attached property} */ @@ -498,6 +504,13 @@ void QDeclarativeKeyNavigationAttached::setLeft(QDeclarativeItem *i) if (d->left == i) return; d->left = i; + d->leftSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->rightSet){ + other->d_func()->right = qobject_cast<QDeclarativeItem*>(parent()); + emit other->rightChanged(); + } emit leftChanged(); } @@ -513,6 +526,13 @@ void QDeclarativeKeyNavigationAttached::setRight(QDeclarativeItem *i) if (d->right == i) return; d->right = i; + d->rightSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->leftSet){ + other->d_func()->left = qobject_cast<QDeclarativeItem*>(parent()); + emit other->leftChanged(); + } emit rightChanged(); } @@ -528,6 +548,13 @@ void QDeclarativeKeyNavigationAttached::setUp(QDeclarativeItem *i) if (d->up == i) return; d->up = i; + d->upSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->downSet){ + other->d_func()->down = qobject_cast<QDeclarativeItem*>(parent()); + emit other->downChanged(); + } emit upChanged(); } @@ -543,6 +570,13 @@ void QDeclarativeKeyNavigationAttached::setDown(QDeclarativeItem *i) if (d->down == i) return; d->down = i; + d->downSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->upSet){ + other->d_func()->up = qobject_cast<QDeclarativeItem*>(parent()); + emit other->upChanged(); + } emit downChanged(); } @@ -558,6 +592,13 @@ void QDeclarativeKeyNavigationAttached::setTab(QDeclarativeItem *i) if (d->tab == i) return; d->tab = i; + d->tabSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->backtabSet){ + other->d_func()->backtab = qobject_cast<QDeclarativeItem*>(parent()); + emit other->backtabChanged(); + } emit tabChanged(); } @@ -573,6 +614,13 @@ void QDeclarativeKeyNavigationAttached::setBacktab(QDeclarativeItem *i) if (d->backtab == i) return; d->backtab = i; + d->backtabSet = true; + QDeclarativeKeyNavigationAttached* other = + qobject_cast<QDeclarativeKeyNavigationAttached*>(qmlAttachedPropertiesObject<QDeclarativeKeyNavigationAttached>(i)); + if(other && !other->d_func()->tabSet){ + other->d_func()->tab = qobject_cast<QDeclarativeItem*>(parent()); + emit other->tabChanged(); + } emit backtabChanged(); } diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index dae581c94f..3ad67c6b5e 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -382,7 +382,10 @@ class QDeclarativeKeyNavigationAttachedPrivate : public QObjectPrivate { public: QDeclarativeKeyNavigationAttachedPrivate() - : QObjectPrivate(), left(0), right(0), up(0), down(0), tab(0), backtab(0) {} + : QObjectPrivate(), + left(0), right(0), up(0), down(0), tab(0), backtab(0), + leftSet(false), rightSet(false), upSet(false), downSet(false), + tabSet(false), backtabSet(false) {} QDeclarativeItem *left; QDeclarativeItem *right; @@ -390,6 +393,12 @@ public: QDeclarativeItem *down; QDeclarativeItem *tab; QDeclarativeItem *backtab; + bool leftSet : 1; + bool rightSet : 1; + bool upSet : 1; + bool downSet : 1; + bool tabSet : 1; + bool backtabSet : 1; }; class QDeclarativeKeyNavigationAttached : public QObject, public QDeclarativeItemKeyFilter diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index af2c8f38d7..932e0740cd 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -273,7 +273,6 @@ void QDeclarativeTextEdit::setText(const QString &text) \o TextEdit.AutoText \o TextEdit.PlainText \o TextEdit.RichText - \o TextEdit.StyledText \endlist The default is TextEdit.AutoText. If the text format is TextEdit.AutoText the text edit @@ -1110,7 +1109,7 @@ void QDeclarativeTextEdit::setMouseSelectionMode(SelectionMode mode) /*! \qmlproperty bool TextEdit::readOnly - Whether the user an interact with the TextEdit item. If this + Whether the user can interact with the TextEdit item. If this property is set to true the text cannot be edited by user interaction. By default this property is false. |