diff options
author | Martin Smith <martin.smith@nokia.com> | 2010-07-13 09:33:02 (GMT) |
---|---|---|
committer | Martin Smith <martin.smith@nokia.com> | 2010-07-13 09:33:02 (GMT) |
commit | e305732c0df93332a514a957b08e0ce283cb747f (patch) | |
tree | 603522227e5d4e9f2994408afd5d5523951ba648 /src/declarative/graphicsitems/qdeclarativetextedit.cpp | |
parent | c93c9bbfe94cd271aeda9e2730d343e3eee31ec5 (diff) | |
parent | a296749eaea94ae4ed36086b632d32c87d3d99c9 (diff) | |
download | Qt-e305732c0df93332a514a957b08e0ce283cb747f.zip Qt-e305732c0df93332a514a957b08e0ce283cb747f.tar.gz Qt-e305732c0df93332a514a957b08e0ce283cb747f.tar.bz2 |
Fixing merge conflicts.
Merge branch '4.7-upstream' into 4.7
Conflicts:
doc/src/declarative/advtutorial.qdoc
src/declarative/graphicsitems/qdeclarativeloader.cpp
src/declarative/graphicsitems/qdeclarativetextedit.cpp
src/declarative/qml/qdeclarativeengine.cpp
src/declarative/util/qdeclarativexmllistmodel.cpp
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetextedit.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextedit.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 3f179da..d13e139 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1264,6 +1264,15 @@ void QDeclarativeTextEditPrivate::init() control = new QTextControl(q); control->setIgnoreUnusedNavigationEvents(true); + // QTextControl follows the default text color + // defined by the platform, declarative text + // should be black by default + QPalette pal = control->palette(); + if (pal.color(QPalette::Text) != color) { + pal.setColor(QPalette::Text, color); + control->setPalette(pal); + } + QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged())); @@ -1333,6 +1342,15 @@ QRectF QDeclarativeTextEdit::boundingRect() const { Q_D(const QDeclarativeTextEdit); QRectF r = QDeclarativePaintedItem::boundingRect(); + int cursorWidth = 1; + if(d->cursor) + cursorWidth = d->cursor->width(); + if(!d->document->isEmpty()) + cursorWidth += 3;// ### Need a better way of accounting for space between char and cursor + + // Could include font max left/right bearings to either side of rectangle. + + r.setRight(r.right() + cursorWidth); return r.translated(0,d->yoff); } @@ -1372,12 +1390,6 @@ void QDeclarativeTextEdit::updateSize() int newWidth = qCeil(d->document->idealWidth()); if (!widthValid() && d->document->textWidth() != newWidth) d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug) - int cursorWidth = 1; - if(d->cursor) - cursorWidth = d->cursor->width(); - newWidth += cursorWidth; - if(!d->document->isEmpty()) - newWidth += 3;// ### Need a better way of accounting for space between char and cursor // ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed. setImplicitWidth(newWidth); qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height(); |