diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-05-04 16:07:32 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-14 00:51:15 +0200 |
commit | bd5e23a00e97603c1cc73328c508a044f1528802 (patch) | |
tree | 8ffe4145ec6d62c5d9e0798af9d48c29d66ff176 /src/quick/items/qquicktextinput_p_p.h | |
parent | 6f9b3893c8c7bc0b6663acb34c17c120852ef7b7 (diff) |
Defer construction of TextEdit/TextInput delegates.
Don't create instances of the delegate components until the item
gains focus, or the cursorVisible property is set to true.
Cursor delegates are typically small and relatively fast to create and
so won't have a significant cost during a one off focus in event,
but that cost can still add up when creating a number of TextInputs
or TextEdits at once. If a delegate that is instantiated immeditately
is required it is possible to instead create a child item and bind to
the cursorRectangle and cursorVisible properties.
Change-Id: I5ec2b5b6a30e534aee3dd5a58c6a5ac0686f5ce2
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktextinput_p_p.h')
-rw-r--r-- | src/quick/items/qquicktextinput_p_p.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 34aa0726d3..2648af160d 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -74,8 +74,11 @@ class QQuickTextNode; class Q_AUTOTEST_EXPORT QQuickTextInputPrivate : public QQuickImplicitSizeItemPrivate { - Q_DECLARE_PUBLIC(QQuickTextInput) public: + Q_DECLARE_PUBLIC(QQuickTextInput) + + typedef QQuickTextInput Public; + QQuickTextInputPrivate() : hscroll(0) , vscroll(0) @@ -105,6 +108,7 @@ public: , m_passwordCharacter(QLatin1Char('*')) , focusOnPress(true) , cursorVisible(false) + , cursorPending(false) , autoScroll(true) , selectByMouse(false) , canPaste(false) @@ -235,6 +239,7 @@ public: bool focusOnPress:1; bool cursorVisible:1; + bool cursorPending:1; bool autoScroll:1; bool selectByMouse:1; bool canPaste:1; @@ -265,6 +270,8 @@ public: return !tripleClickTimer.hasExpired(qApp->styleHints()->mouseDoubleClickInterval()); } + void setNativeCursorEnabled(bool enabled) { + setCursorBlinkPeriod(enabled && cursorVisible ? qApp->styleHints()->cursorFlashTime() : 0); } int nextMaskBlank(int pos) { |