src/declarative/graphicsitems/qdeclarativetextinput_p.h
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h	Wed Aug 18 10:37:55 2010 +0300
@@ -56,7 +56,7 @@
 
 class QDeclarativeTextInputPrivate;
 class QValidator;
-class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem
+class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativePaintedItem
 {
     Q_OBJECT
     Q_ENUMS(HAlignment)
@@ -72,20 +72,22 @@
     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
     Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
     Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
-    Q_PROPERTY(QRect cursorRect READ cursorRect NOTIFY cursorPositionChanged)
+    Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorPositionChanged)
     Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
-    Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged)
-    Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged)
+    Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged)
+    Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged)
     Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged)
 
     Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged)
+#ifndef QT_NO_VALIDATOR
     Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged)
+#endif
     Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged)
     Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
 
     Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged)
     Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
-    Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged)
+    Q_PROPERTY(bool activeFocusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY activeFocusOnPressChanged)
     Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged)
     Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged)
     Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged)
@@ -109,9 +111,13 @@
     };
 
     //Auxilliary functions needed to control the TextInput from QML
-    Q_INVOKABLE int xToPosition(int x);
+    Q_INVOKABLE int positionAt(int x) const;
+    Q_INVOKABLE QRectF positionToRectangle(int pos) const;
     Q_INVOKABLE void moveCursorSelection(int pos);
 
+    Q_INVOKABLE void openSoftwareInputPanel();
+    Q_INVOKABLE void closeSoftwareInputPanel();
+
     QString text() const;
     void setText(const QString &);
 
@@ -139,22 +145,20 @@
     int cursorPosition() const;
     void setCursorPosition(int cp);
 
-    QRect cursorRect() const;
+    QRect cursorRectangle() const;
 
     int selectionStart() const;
-    void setSelectionStart(int);
-
     int selectionEnd() const;
-    void setSelectionEnd(int);
 
     QString selectedText() const;
 
     int maxLength() const;
     void setMaxLength(int ml);
 
+#ifndef QT_NO_VALIDATOR
     QValidator * validator() const;
     void setValidator(QValidator* v);
-
+#endif
     QString inputMask() const;
     void setInputMask(const QString &im);
 
@@ -183,6 +187,8 @@
     void drawContents(QPainter *p,const QRect &r);
     QVariant inputMethodQuery(Qt::InputMethodQuery property) const;
 
+    QRectF boundingRect() const;
+
 Q_SIGNALS:
     void textChanged();
     void cursorPositionChanged();
@@ -204,8 +210,8 @@
     void inputMaskChanged(const QString &inputMask);
     void echoModeChanged(EchoMode echoMode);
     void passwordCharacterChanged();
-    void displayTextChanged(const QString &text);
-    void focusOnPressChanged(bool focusOnPress);
+    void displayTextChanged();
+    void activeFocusOnPressChanged(bool activeFocusOnPress);
     void autoScrollChanged(bool autoScroll);
     void selectByMouseChanged(bool selectByMouse);
 
@@ -216,11 +222,21 @@
     void mousePressEvent(QGraphicsSceneMouseEvent *event);
     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
     void keyPressEvent(QKeyEvent* ev);
+    void inputMethodEvent(QInputMethodEvent *);
     bool event(QEvent *e);
+    void focusInEvent(QFocusEvent *event);
 
 public Q_SLOTS:
     void selectAll();
+    void selectWord();
+    void select(int start, int end);
+#ifndef QT_NO_CLIPBOARD
+    void cut();
+    void copy();
+    void paste();
+#endif
 
 private Q_SLOTS:
     void updateSize(bool needsRedraw = true);
@@ -238,10 +254,12 @@
 QT_END_NAMESPACE
 
 QML_DECLARE_TYPE(QDeclarativeTextInput)
+#ifndef QT_NO_VALIDATOR
 QML_DECLARE_TYPE(QValidator)
 QML_DECLARE_TYPE(QIntValidator)
 QML_DECLARE_TYPE(QDoubleValidator)
 QML_DECLARE_TYPE(QRegExpValidator)
+#endif
 
 QT_END_HEADER