summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-07-07 04:16:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-07-07 04:16:46 (GMT)
commite429284e7d6f6639d5e07c113c45f400a02a8fa1 (patch)
tree36949f3ebf25dbdd93e68fd4be706c2f5effcc94 /src/gui
parent19f55bfa5bf15b5593f3021071374dbe2f71f8c8 (diff)
parentb4b1b118015d1dcef63b065a609234a18f332ba4 (diff)
downloadQt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.zip
Qt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.tar.gz
Qt-e429284e7d6f6639d5e07c113c45f400a02a8fa1.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (35 commits) Make Text, TextInput, and TextEdit all have the same size for the same text. More generated images in anticipation of QT-3574 Remove deprecated Flickable.flickDirection Revert "Fix exponential behavior of QTextCursor::removeSelectedText" Prevent a recursive debug output loop when writing to the logger widget. Fix performance of QTextDocumentPrivate::adjustDocumentChangesAndCursors Convert QtDeclarative def files to use LF line endings Update QtDeclarative def files doc improvements Changing currentIndex shouldn't cancel a flick unnecessarily. Fix input methods for TextInput elements with key handlers Document the QML enumeration basic type Fix TextEdit with no color property defined is drawn with wrong color Export QDeclarativePixmap doc Fix inconsistent reporting of module import errors when using versions. Make declarative pixmap cache easier to use Prepare for QTest persistent store for visual tests. Loosen font-sensitive test. Set correct license header. ...
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/text/qtextcursor.cpp3
-rw-r--r--src/gui/text/qtextcursor_p.h1
-rw-r--r--src/gui/text/qtextdocument_p.cpp34
-rw-r--r--src/gui/text/qtextdocument_p.h5
4 files changed, 22 insertions, 21 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index a9caa6b..63aa946 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -64,7 +64,8 @@ enum {
QTextCursorPrivate::QTextCursorPrivate(QTextDocumentPrivate *p)
: priv(p), x(0), position(0), anchor(0), adjusted_anchor(0),
- currentCharFormat(-1), visualNavigation(false), keepPositionOnInsert(false)
+ currentCharFormat(-1), visualNavigation(false), keepPositionOnInsert(false),
+ changed(false)
{
priv->addCursor(this);
}
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index 4e36b95..4b3262f 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -114,6 +114,7 @@ public:
int currentCharFormat;
uint visualNavigation : 1;
uint keepPositionOnInsert : 1;
+ uint changed : 1;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index f3cd481..9bcf8b4 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -234,17 +234,17 @@ void QTextDocumentPrivate::init()
void QTextDocumentPrivate::clear()
{
Q_Q(QTextDocument);
- for (int i = 0; i < cursors.count(); ++i) {
- cursors.at(i)->setPosition(0);
- cursors.at(i)->currentCharFormat = -1;
- cursors.at(i)->anchor = 0;
- cursors.at(i)->adjusted_anchor = 0;
+
+ foreach (QTextCursorPrivate *curs, cursors) {
+ curs->setPosition(0);
+ curs->currentCharFormat = -1;
+ curs->anchor = 0;
+ curs->adjusted_anchor = 0;
}
QList<QTextCursorPrivate *>oldCursors = cursors;
QT_TRY{
cursors.clear();
- changedCursors.clear();
QMap<int, QTextObject *>::Iterator objectIt = objects.begin();
while (objectIt != objects.end()) {
@@ -287,8 +287,8 @@ void QTextDocumentPrivate::clear()
QTextDocumentPrivate::~QTextDocumentPrivate()
{
- for (int i = 0; i < cursors.count(); ++i)
- cursors.at(i)->priv = 0;
+ foreach (QTextCursorPrivate *curs, cursors)
+ curs->priv = 0;
cursors.clear();
undoState = 0;
undoEnabled = true;
@@ -1221,9 +1221,11 @@ void QTextDocumentPrivate::finishEdit()
}
}
- while (!changedCursors.isEmpty()) {
- QTextCursorPrivate *curs = changedCursors.takeFirst();
- emit q->cursorPositionChanged(QTextCursor(curs));
+ foreach (QTextCursorPrivate *curs, cursors) {
+ if (curs->changed) {
+ curs->changed = false;
+ emit q->cursorPositionChanged(QTextCursor(curs));
+ }
}
contentsChanged();
@@ -1266,11 +1268,9 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr
if (!editBlock)
++revision;
- for (int i = 0; i < cursors.size(); ++i) {
- QTextCursorPrivate *curs = cursors.at(i);
+ foreach (QTextCursorPrivate *curs, cursors) {
if (curs->adjustPosition(from, addedOrRemoved, op) == QTextCursorPrivate::CursorMoved) {
- if (!changedCursors.contains(curs))
- changedCursors.append(curs);
+ curs->changed = true;
}
}
@@ -1693,8 +1693,8 @@ bool QTextDocumentPrivate::ensureMaximumBlockCount()
void QTextDocumentPrivate::aboutToRemoveCell(int from, int to)
{
Q_ASSERT(from <= to);
- for (int i = 0; i < cursors.size(); ++i)
- cursors.at(i)->aboutToRemoveCell(from, to);
+ foreach (QTextCursorPrivate *curs, cursors)
+ curs->aboutToRemoveCell(from, to);
}
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index d1bd698..b9d5f5a 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -277,7 +277,7 @@ public:
void documentChange(int from, int length);
inline void addCursor(QTextCursorPrivate *c) { cursors.append(c); }
- inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); changedCursors.removeAll(c); }
+ inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); }
QTextFrame *frameAt(int pos) const;
QTextFrame *rootFrame() const;
@@ -329,8 +329,7 @@ private:
BlockMap blocks;
int initialBlockCharFormatIndex;
- QList<QTextCursorPrivate*> cursors;
- QList<QTextCursorPrivate*> changedCursors;
+ QList<QTextCursorPrivate *> cursors;
QMap<int, QTextObject *> objects;
QMap<QUrl, QVariant> resources;
QMap<QUrl, QVariant> cachedResources;