70 Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) |
70 Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) |
71 |
71 |
72 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) |
72 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) |
73 Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) |
73 Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) |
74 Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) |
74 Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) |
75 Q_PROPERTY(QRect cursorRect READ cursorRect NOTIFY cursorPositionChanged) |
75 Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorPositionChanged) |
76 Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) |
76 Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged) |
77 Q_PROPERTY(int selectionStart READ selectionStart WRITE setSelectionStart NOTIFY selectionStartChanged) |
77 Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged) |
78 Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) |
78 Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged) |
79 Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) |
79 Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) |
80 |
80 |
81 Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged) |
81 Q_PROPERTY(int maximumLength READ maxLength WRITE setMaxLength NOTIFY maximumLengthChanged) |
|
82 #ifndef QT_NO_VALIDATOR |
82 Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged) |
83 Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged) |
|
84 #endif |
83 Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged) |
85 Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged) |
84 Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) |
86 Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) |
85 |
87 |
86 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) |
88 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) |
87 Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) |
89 Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) |
88 Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged) |
90 Q_PROPERTY(bool activeFocusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY activeFocusOnPressChanged) |
89 Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged) |
91 Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged) |
90 Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) |
92 Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) |
91 Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) |
93 Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) |
92 Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) |
94 Q_PROPERTY(bool selectByMouse READ selectByMouse WRITE setSelectByMouse NOTIFY selectByMouseChanged) |
93 |
95 |
107 AlignRight = Qt::AlignRight, |
109 AlignRight = Qt::AlignRight, |
108 AlignHCenter = Qt::AlignHCenter |
110 AlignHCenter = Qt::AlignHCenter |
109 }; |
111 }; |
110 |
112 |
111 //Auxilliary functions needed to control the TextInput from QML |
113 //Auxilliary functions needed to control the TextInput from QML |
112 Q_INVOKABLE int xToPosition(int x); |
114 Q_INVOKABLE int positionAt(int x) const; |
|
115 Q_INVOKABLE QRectF positionToRectangle(int pos) const; |
113 Q_INVOKABLE void moveCursorSelection(int pos); |
116 Q_INVOKABLE void moveCursorSelection(int pos); |
|
117 |
|
118 Q_INVOKABLE void openSoftwareInputPanel(); |
|
119 Q_INVOKABLE void closeSoftwareInputPanel(); |
114 |
120 |
115 QString text() const; |
121 QString text() const; |
116 void setText(const QString &); |
122 void setText(const QString &); |
117 |
123 |
118 QFont font() const; |
124 QFont font() const; |
137 void setCursorVisible(bool on); |
143 void setCursorVisible(bool on); |
138 |
144 |
139 int cursorPosition() const; |
145 int cursorPosition() const; |
140 void setCursorPosition(int cp); |
146 void setCursorPosition(int cp); |
141 |
147 |
142 QRect cursorRect() const; |
148 QRect cursorRectangle() const; |
143 |
149 |
144 int selectionStart() const; |
150 int selectionStart() const; |
145 void setSelectionStart(int); |
|
146 |
|
147 int selectionEnd() const; |
151 int selectionEnd() const; |
148 void setSelectionEnd(int); |
|
149 |
152 |
150 QString selectedText() const; |
153 QString selectedText() const; |
151 |
154 |
152 int maxLength() const; |
155 int maxLength() const; |
153 void setMaxLength(int ml); |
156 void setMaxLength(int ml); |
154 |
157 |
|
158 #ifndef QT_NO_VALIDATOR |
155 QValidator * validator() const; |
159 QValidator * validator() const; |
156 void setValidator(QValidator* v); |
160 void setValidator(QValidator* v); |
157 |
161 #endif |
158 QString inputMask() const; |
162 QString inputMask() const; |
159 void setInputMask(const QString &im); |
163 void setInputMask(const QString &im); |
160 |
164 |
161 EchoMode echoMode() const; |
165 EchoMode echoMode() const; |
162 void setEchoMode(EchoMode echo); |
166 void setEchoMode(EchoMode echo); |
180 |
184 |
181 bool hasAcceptableInput() const; |
185 bool hasAcceptableInput() const; |
182 |
186 |
183 void drawContents(QPainter *p,const QRect &r); |
187 void drawContents(QPainter *p,const QRect &r); |
184 QVariant inputMethodQuery(Qt::InputMethodQuery property) const; |
188 QVariant inputMethodQuery(Qt::InputMethodQuery property) const; |
|
189 |
|
190 QRectF boundingRect() const; |
185 |
191 |
186 Q_SIGNALS: |
192 Q_SIGNALS: |
187 void textChanged(); |
193 void textChanged(); |
188 void cursorPositionChanged(); |
194 void cursorPositionChanged(); |
189 void selectionStartChanged(); |
195 void selectionStartChanged(); |
202 void maximumLengthChanged(int maximumLength); |
208 void maximumLengthChanged(int maximumLength); |
203 void validatorChanged(); |
209 void validatorChanged(); |
204 void inputMaskChanged(const QString &inputMask); |
210 void inputMaskChanged(const QString &inputMask); |
205 void echoModeChanged(EchoMode echoMode); |
211 void echoModeChanged(EchoMode echoMode); |
206 void passwordCharacterChanged(); |
212 void passwordCharacterChanged(); |
207 void displayTextChanged(const QString &text); |
213 void displayTextChanged(); |
208 void focusOnPressChanged(bool focusOnPress); |
214 void activeFocusOnPressChanged(bool activeFocusOnPress); |
209 void autoScrollChanged(bool autoScroll); |
215 void autoScrollChanged(bool autoScroll); |
210 void selectByMouseChanged(bool selectByMouse); |
216 void selectByMouseChanged(bool selectByMouse); |
211 |
217 |
212 protected: |
218 protected: |
213 virtual void geometryChanged(const QRectF &newGeometry, |
219 virtual void geometryChanged(const QRectF &newGeometry, |
214 const QRectF &oldGeometry); |
220 const QRectF &oldGeometry); |
215 |
221 |
216 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
222 void mousePressEvent(QGraphicsSceneMouseEvent *event); |
217 void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
223 void mouseMoveEvent(QGraphicsSceneMouseEvent *event); |
218 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
224 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); |
|
225 void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); |
219 void keyPressEvent(QKeyEvent* ev); |
226 void keyPressEvent(QKeyEvent* ev); |
|
227 void inputMethodEvent(QInputMethodEvent *); |
220 bool event(QEvent *e); |
228 bool event(QEvent *e); |
|
229 void focusInEvent(QFocusEvent *event); |
221 |
230 |
222 public Q_SLOTS: |
231 public Q_SLOTS: |
223 void selectAll(); |
232 void selectAll(); |
|
233 void selectWord(); |
|
234 void select(int start, int end); |
|
235 #ifndef QT_NO_CLIPBOARD |
|
236 void cut(); |
|
237 void copy(); |
|
238 void paste(); |
|
239 #endif |
224 |
240 |
225 private Q_SLOTS: |
241 private Q_SLOTS: |
226 void updateSize(bool needsRedraw = true); |
242 void updateSize(bool needsRedraw = true); |
227 void q_textChanged(); |
243 void q_textChanged(); |
228 void selectionChanged(); |
244 void selectionChanged(); |
236 }; |
252 }; |
237 |
253 |
238 QT_END_NAMESPACE |
254 QT_END_NAMESPACE |
239 |
255 |
240 QML_DECLARE_TYPE(QDeclarativeTextInput) |
256 QML_DECLARE_TYPE(QDeclarativeTextInput) |
|
257 #ifndef QT_NO_VALIDATOR |
241 QML_DECLARE_TYPE(QValidator) |
258 QML_DECLARE_TYPE(QValidator) |
242 QML_DECLARE_TYPE(QIntValidator) |
259 QML_DECLARE_TYPE(QIntValidator) |
243 QML_DECLARE_TYPE(QDoubleValidator) |
260 QML_DECLARE_TYPE(QDoubleValidator) |
244 QML_DECLARE_TYPE(QRegExpValidator) |
261 QML_DECLARE_TYPE(QRegExpValidator) |
|
262 #endif |
245 |
263 |
246 QT_END_HEADER |
264 QT_END_HEADER |
247 |
265 |
248 #endif // QDECLARATIVETEXTINPUT_H |
266 #endif // QDECLARATIVETEXTINPUT_H |