summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativetextedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 2cb1c94..af2c8f3 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -582,6 +582,7 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment)
d->vAlign = alignment;
d->updateDefaultTextOption();
updateSize();
+ moveCursorDelegate();
emit verticalAlignmentChanged(d->vAlign);
}
@@ -870,8 +871,6 @@ void QDeclarativeTextEdit::setCursorDelegate(QDeclarativeComponent* c)
Q_D(QDeclarativeTextEdit);
if(d->cursorComponent){
if(d->cursor){
- disconnect(d->control, SIGNAL(cursorPositionChanged()),
- this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(-1);
dirtyCache(cursorRectangle());
delete d->cursor;
@@ -897,8 +896,6 @@ void QDeclarativeTextEdit::loadCursorDelegate()
return;
d->cursor = qobject_cast<QDeclarativeItem*>(d->cursorComponent->create(qmlContext(this)));
if(d->cursor){
- connect(d->control, SIGNAL(cursorPositionChanged()),
- this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(0);
dirtyCache(cursorRectangle());
QDeclarative_setParent_noEvent(d->cursor, this);
@@ -1173,7 +1170,7 @@ Qt::TextInteractionFlags QDeclarativeTextEdit::textInteractionFlags() const
QRect QDeclarativeTextEdit::cursorRectangle() const
{
Q_D(const QDeclarativeTextEdit);
- return d->control->cursorRect().toRect().translated(0,-d->yoff);
+ return d->control->cursorRect().toRect().translated(0,d->yoff);
}
@@ -1558,7 +1555,7 @@ void QDeclarativeTextEditPrivate::init()
QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
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(microFocusChanged()), q, SLOT(moveCursorDelegate()));
QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
#ifndef QT_NO_CLIPBOARD
QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged()));
@@ -1583,16 +1580,17 @@ void QDeclarativeTextEdit::q_textChanged()
d->updateDefaultTextOption();
updateSize();
updateTotalLines();
- updateMicroFocus();
emit textChanged(d->text);
}
void QDeclarativeTextEdit::moveCursorDelegate()
{
Q_D(QDeclarativeTextEdit);
+ updateMicroFocus();
+ emit cursorRectangleChanged();
if(!d->cursor)
return;
- QRectF cursorRect = d->control->cursorRect();
+ QRectF cursorRect = cursorRectangle();
d->cursor->setX(cursorRect.x());
d->cursor->setY(cursorRect.y());
}
@@ -1625,7 +1623,6 @@ void QDeclarativeTextEdit::updateSelectionMarkers()
d->lastSelectionEnd = d->control->textCursor().selectionEnd();
emit selectionEndChanged();
}
- updateMicroFocus();
}
QRectF QDeclarativeTextEdit::boundingRect() const