aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgtextinput_p_p.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-06-01 09:45:55 +0200
committerQt by Nokia <qt-info@nokia.com>2011-08-19 15:15:56 +0200
commit1cc58fdf174656a52603af00cb40478066c5abd4 (patch)
tree432054d60316a981b17655dc888805e4e5434966 /src/declarative/items/qsgtextinput_p_p.h
parent7059861a8b8d48b5187eb46a2678f306ba288320 (diff)
Make QSGTextNode back-end for QML's TextInput and TextEdit
Use the general QSGTextNode class as back-end for all text elements in QML to make all text elements look the same and use the same text rasterization back-end. This requires a few rewrites in the text node to support e.g. selections. Crashes seen with threaded renderer in TextEdit and TextInput on Mac are also fixed by this. Reviewed-by: Jiang Jiang Task-number: QTBUG-18019, QTBUG-20017 Change-Id: I4207faf180c83422e5f8b726741321af395bd724 Reviewed-on: http://codereview.qt.nokia.com/2865 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/declarative/items/qsgtextinput_p_p.h')
-rw-r--r--src/declarative/items/qsgtextinput_p_p.h39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/declarative/items/qsgtextinput_p_p.h b/src/declarative/items/qsgtextinput_p_p.h
index f25722972b..0d1f21b54c 100644
--- a/src/declarative/items/qsgtextinput_p_p.h
+++ b/src/declarative/items/qsgtextinput_p_p.h
@@ -65,18 +65,35 @@
QT_BEGIN_NAMESPACE
-class Q_AUTOTEST_EXPORT QSGTextInputPrivate : public QSGImplicitSizePaintedItemPrivate
+class QSGTextNode;
+
+class Q_AUTOTEST_EXPORT QSGTextInputPrivate : public QSGImplicitSizeItemPrivate
{
Q_DECLARE_PUBLIC(QSGTextInput)
public:
- QSGTextInputPrivate() : control(new QLineControl(QString())),
- color((QRgb)0), style(QSGText::Normal),
- styleColor((QRgb)0), hAlign(QSGTextInput::AlignLeft),
- mouseSelectionMode(QSGTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
- hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
- showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
- autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
- selectPressed(false)
+ QSGTextInputPrivate()
+ : control(new QLineControl(QString()))
+ , color((QRgb)0)
+ , style(QSGText::Normal)
+ , styleColor((QRgb)0)
+ , hAlign(QSGTextInput::AlignLeft)
+ , mouseSelectionMode(QSGTextInput::SelectCharacters)
+ , inputMethodHints(Qt::ImhNone)
+ , textNode(0)
+ , hscroll(0)
+ , oldScroll(0)
+ , oldValidity(false)
+ , focused(false)
+ , focusOnPress(true)
+ , showInputPanelOnFocus(true)
+ , clickCausedFocus(false)
+ , cursorVisible(false)
+ , autoScroll(true)
+ , selectByMouse(false)
+ , canPaste(false)
+ , hAlignImplicit(true)
+ , selectPressed(false)
+ , textLayoutDirty(true)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@@ -106,6 +123,8 @@ public:
int calculateTextWidth();
bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType);
void updateInputMethodHints();
+ void hideCursor();
+ void showCursor();
QLineControl* control;
@@ -122,6 +141,7 @@ public:
QPointer<QDeclarativeComponent> cursorComponent;
QPointer<QSGItem> cursorItem;
QPointF pressPos;
+ QSGTextNode *textNode;
int lastSelectionStart;
int lastSelectionEnd;
@@ -141,6 +161,7 @@ public:
bool canPaste:1;
bool hAlignImplicit:1;
bool selectPressed:1;
+ bool textLayoutDirty:1;
static inline QSGTextInputPrivate *get(QSGTextInput *t) {
return t->d_func();