aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextedit.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-02-21 13:31:19 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-23 01:19:51 +0100
commita08546507fe0ce356e4183e557d9408295c80610 (patch)
tree67b1c3f9a3ce626335be3accb9f1bf9f8b486c03 /src/quick/items/qquicktextedit.cpp
parent6a42a6e0a9a1abdda0d07a5a20b4ac7e45348684 (diff)
Reduce QQuickTextEdit memory usage.
Remove unnecessary members from QQuickTextEditPrivate and QQuickTextControlPrivate and re-order and pack to reduce padding for alignment. Change-Id: I14f5e3fc01646d02745f095c2a4b168cd675745d Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktextedit.cpp')
-rw-r--r--src/quick/items/qquicktextedit.cpp43
1 files changed, 11 insertions, 32 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 6f3c32db7d..06264715a1 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -399,9 +399,6 @@ void QQuickTextEdit::setColor(const QColor &color)
return;
d->color = color;
- QPalette pal = d->control->palette();
- pal.setColor(QPalette::Text, color);
- d->control->setPalette(pal);
updateDocument();
emit colorChanged(d->color);
}
@@ -424,9 +421,6 @@ void QQuickTextEdit::setSelectionColor(const QColor &color)
return;
d->selectionColor = color;
- QPalette pal = d->control->palette();
- pal.setColor(QPalette::Highlight, color);
- d->control->setPalette(pal);
updateDocument();
emit selectionColorChanged(d->selectionColor);
}
@@ -449,9 +443,6 @@ void QQuickTextEdit::setSelectedTextColor(const QColor &color)
return;
d->selectedTextColor = color;
- QPalette pal = d->control->palette();
- pal.setColor(QPalette::HighlightedText, color);
- d->control->setPalette(pal);
updateDocument();
emit selectedTextColorChanged(d->selectedTextColor);
}
@@ -1634,10 +1625,8 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
QRectF bounds = boundingRect();
- QColor selectionColor = d->control->palette().color(QPalette::Highlight);
- QColor selectedTextColor = d->control->palette().color(QPalette::HighlightedText);
node->addTextDocument(bounds.topLeft(), d->document, d->color, QQuickText::Normal, QColor(),
- selectionColor, selectedTextColor, selectionStart(),
+ d->selectionColor, d->selectedTextColor, selectionStart(),
selectionEnd() - 1); // selectionEnd() returns first char after
// selection
@@ -1756,31 +1745,21 @@ void QQuickTextEditPrivate::init()
document = new QQuickTextDocumentWithImageResources(q);
control = new QQuickTextControl(document, q);
- control->setView(q);
control->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextEditable);
control->setAcceptRichText(false);
control->setCursorIsFocusIndicator(true);
- // QQuickTextControl 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(updateDocument()));
- QObject::connect(control, SIGNAL(updateCursorRequest()), q, SLOT(updateCursor()));
- QObject::connect(control, SIGNAL(textChanged()), q, SLOT(q_textChanged()));
- QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
- 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(cursorRectangleChanged()), q, SLOT(moveCursorDelegate()));
- QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
+ FAST_CONNECT(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateDocument()));
+ FAST_CONNECT(control, SIGNAL(updateCursorRequest()), q, SLOT(updateCursor()));
+ FAST_CONNECT(control, SIGNAL(textChanged()), q, SLOT(q_textChanged()));
+ FAST_CONNECT(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
+ FAST_CONNECT(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
+ FAST_CONNECT(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers()));
+ FAST_CONNECT(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ FAST_CONNECT(control, SIGNAL(cursorRectangleChanged()), q, SLOT(moveCursorDelegate()));
+ FAST_CONNECT(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
#ifndef QT_NO_CLIPBOARD
- QObject::connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), q, SLOT(q_canPasteChanged()));
+ FAST_CONNECT(QGuiApplication::clipboard(), SIGNAL(dataChanged()), q, SLOT(q_canPasteChanged()));
#endif
FAST_CONNECT(document, SIGNAL(undoAvailable(bool)), q, SIGNAL(canUndoChanged()));
FAST_CONNECT(document, SIGNAL(redoAvailable(bool)), q, SIGNAL(canRedoChanged()));