diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/QmlChanges.txt | 2 | ||||
-rw-r--r-- | src/declarative/fx/qfxpositioners.cpp | 12 | ||||
-rw-r--r-- | src/declarative/fx/qfxtextinput.cpp | 11 |
3 files changed, 24 insertions, 1 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 9bf4b10..db1c73a 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -59,6 +59,8 @@ WebView: status -> statusText WebView: mouseX -> clickX (parameter to onDoubleClick) WebView: mouseY -> clickY (parameter to onDoubleClick) WebView: cacheSize -> pixelCacheSize +Repeater: component -> delegate +Repeater: dataSource -> model Additions: MouseRegion: add "acceptedButtons" property diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index bad4944..e4500aa 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -251,6 +251,18 @@ void QFxBasePositioner::prePositioning() d->_animated.clear(); doPositioning(); finishApplyTransitions(); + //Set implicit size to the size of its children + //###To keep this valid, do we need to update on pos change as well? + qreal h = 0.0f; + qreal w = 0.0f; + foreach(QFxItem *child, d->_items){ + if(!child->isVisible() || child->opacity() <= 0) + continue; + h = qMax(h, child->y() + child->height()); + w = qMax(w, child->x() + child->width()); + } + setImplicitHeight(h); + setImplicitWidth(w); } void QFxBasePositioner::applyTransition(const QList<QPair<QString, QVariant> >& changes, QFxItem* target, QmlStateOperation::ActionList &actions) diff --git a/src/declarative/fx/qfxtextinput.cpp b/src/declarative/fx/qfxtextinput.cpp index 4dd29cd..39a0187 100644 --- a/src/declarative/fx/qfxtextinput.cpp +++ b/src/declarative/fx/qfxtextinput.cpp @@ -480,6 +480,13 @@ void QFxTextInput::focusChanged(bool hasFocus) void QFxTextInput::keyPressEvent(QKeyEvent* ev) { Q_D(QFxTextInput); + if((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) + || (d->control->cursor() == d->control->text().length() + && ev->key() == Qt::Key_Right)){ + //ignore moving off the end + ev->ignore(); + return; + } d->control->processKeyEvent(ev); if (!ev->isAccepted()) QFxPaintedItem::keyPressEvent(ev); @@ -500,6 +507,7 @@ bool QFxTextInput::event(QEvent* ev) Q_D(QFxTextInput); //Anything we don't deal with ourselves, pass to the control switch(ev->type()){ + case QEvent::KeyPress: case QEvent::GraphicsSceneMousePress: break; default: @@ -645,7 +653,8 @@ void QFxTextInput::updateSize() setImplicitHeight(d->control->height()); //d->control->width() is max width, not current width QFontMetrics fm = QFontMetrics(d->font); - setImplicitWidth(fm.boundingRect(d->control->text()).width()+1); + setImplicitWidth(fm.width(d->control->text())+1); + //setImplicitWidth(d->control->naturalWidth());//### This fn should be coming into 4.6 shortly, and might be faster setContentsSize(QSize(width(), height())); } |