-rw-r--r-- | inputmethods/handwriting/qimpenwidget.cpp | 2 | ||||
-rw-r--r-- | inputmethods/handwriting/qimpenwidget.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/inputmethods/handwriting/qimpenwidget.cpp b/inputmethods/handwriting/qimpenwidget.cpp index 8f8f582..7223e1a 100644 --- a/inputmethods/handwriting/qimpenwidget.cpp +++ b/inputmethods/handwriting/qimpenwidget.cpp | |||
@@ -253,65 +253,65 @@ void QIMPenWidget::timeout() | |||
253 | 253 | ||
254 | /*! | 254 | /*! |
255 | If the point \a p is over one of the character set titles, switch | 255 | If the point \a p is over one of the character set titles, switch |
256 | to the set and return TRUE. | 256 | to the set and return TRUE. |
257 | */ | 257 | */ |
258 | bool QIMPenWidget::selectSet( QPoint p ) | 258 | bool QIMPenWidget::selectSet( QPoint p ) |
259 | { | 259 | { |
260 | if ( charSets.count() ) { | 260 | if ( charSets.count() ) { |
261 | CharSetEntryIterator it( charSets ); | 261 | CharSetEntryIterator it( charSets ); |
262 | int spos = 0; | 262 | int spos = 0; |
263 | int idx = 0; | 263 | int idx = 0; |
264 | for ( ; it.current(); ++it, idx++ ) { | 264 | for ( ; it.current(); ++it, idx++ ) { |
265 | int setWidth = width() * it.current()->stretch / totalStretch; | 265 | int setWidth = width() * it.current()->stretch / totalStretch; |
266 | spos += setWidth; | 266 | spos += setWidth; |
267 | if ( p.x() < spos ) { | 267 | if ( p.x() < spos ) { |
268 | if ( idx != currCharSet ) { | 268 | if ( idx != currCharSet ) { |
269 | currCharSet = idx; | 269 | currCharSet = idx; |
270 | update( 0, 0, width(), 12 ); | 270 | update( 0, 0, width(), 12 ); |
271 | emit changeCharSet( currCharSet ); | 271 | emit changeCharSet( currCharSet ); |
272 | emit changeCharSet( charSets.at(currCharSet)->cs ); | 272 | emit changeCharSet( charSets.at(currCharSet)->cs ); |
273 | } | 273 | } |
274 | break; | 274 | break; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | return FALSE; | 279 | return FALSE; |
280 | } | 280 | } |
281 | 281 | ||
282 | /*! | 282 | /*! |
283 | Hopefully returns a sensible size. | 283 | Hopefully returns a sensible size. |
284 | */ | 284 | */ |
285 | QSize QIMPenWidget::sizeHint() | 285 | QSize QIMPenWidget::sizeHint() const |
286 | { | 286 | { |
287 | return QSize( TITLE_WIDTH * charSets.count(), 75 ); | 287 | return QSize( TITLE_WIDTH * charSets.count(), 75 ); |
288 | } | 288 | } |
289 | 289 | ||
290 | void QIMPenWidget::mousePressEvent( QMouseEvent *e ) | 290 | void QIMPenWidget::mousePressEvent( QMouseEvent *e ) |
291 | { | 291 | { |
292 | if ( !readOnly && e->button() == LeftButton && mode == Waiting ) { | 292 | if ( !readOnly && e->button() == LeftButton && mode == Waiting ) { |
293 | // if selectSet returns false the click was not over the | 293 | // if selectSet returns false the click was not over the |
294 | // char set selectors. | 294 | // char set selectors. |
295 | if ( !selectSet( e->pos() ) ) { | 295 | if ( !selectSet( e->pos() ) ) { |
296 | // start of character input | 296 | // start of character input |
297 | timer->stop(); | 297 | timer->stop(); |
298 | if ( outputChar ) { | 298 | if ( outputChar ) { |
299 | outputChar = 0; | 299 | outputChar = 0; |
300 | outputStroke = 0; | 300 | outputStroke = 0; |
301 | repaint(); | 301 | repaint(); |
302 | } | 302 | } |
303 | mode = Input; | 303 | mode = Input; |
304 | lastPoint = e->pos(); | 304 | lastPoint = e->pos(); |
305 | emit beginStroke(); | 305 | emit beginStroke(); |
306 | inputStroke = new QIMPenStroke; | 306 | inputStroke = new QIMPenStroke; |
307 | strokes.append( inputStroke ); | 307 | strokes.append( inputStroke ); |
308 | inputStroke->beginInput( e->pos() ); | 308 | inputStroke->beginInput( e->pos() ); |
309 | QPainter paint( this ); | 309 | QPainter paint( this ); |
310 | paint.setBrush( Qt::black ); | 310 | paint.setBrush( Qt::black ); |
311 | paint.drawRect( lastPoint.x()-1, lastPoint.y()-1, 2, 2 ); | 311 | paint.drawRect( lastPoint.x()-1, lastPoint.y()-1, 2, 2 ); |
312 | } | 312 | } |
313 | } | 313 | } |
314 | } | 314 | } |
315 | 315 | ||
316 | void QIMPenWidget::mouseReleaseEvent( QMouseEvent *e ) | 316 | void QIMPenWidget::mouseReleaseEvent( QMouseEvent *e ) |
317 | { | 317 | { |
diff --git a/inputmethods/handwriting/qimpenwidget.h b/inputmethods/handwriting/qimpenwidget.h index 98d7f5c..d156554 100644 --- a/inputmethods/handwriting/qimpenwidget.h +++ b/inputmethods/handwriting/qimpenwidget.h | |||
@@ -8,65 +8,65 @@ | |||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qwidget.h> | 21 | #include <qwidget.h> |
22 | #include <qlist.h> | 22 | #include <qlist.h> |
23 | #include "qimpenchar.h" | 23 | #include "qimpenchar.h" |
24 | 24 | ||
25 | class QIMPenWidget : public QWidget | 25 | class QIMPenWidget : public QWidget |
26 | { | 26 | { |
27 | Q_OBJECT | 27 | Q_OBJECT |
28 | public: | 28 | public: |
29 | QIMPenWidget( QWidget *parent ); | 29 | QIMPenWidget( QWidget *parent ); |
30 | 30 | ||
31 | void clear(); | 31 | void clear(); |
32 | void greyStroke(); | 32 | void greyStroke(); |
33 | void setReadOnly( bool r ) { readOnly = r; } | 33 | void setReadOnly( bool r ) { readOnly = r; } |
34 | 34 | ||
35 | void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 ); | 35 | void insertCharSet( QIMPenCharSet *cs, int stretch=1, int pos=-1 ); |
36 | void removeCharSet( int ); | 36 | void removeCharSet( int ); |
37 | void changeCharSet( QIMPenCharSet *cs, int pos ); | 37 | void changeCharSet( QIMPenCharSet *cs, int pos ); |
38 | void clearCharSets(); | 38 | void clearCharSets(); |
39 | void showCharacter( QIMPenChar *, int speed = 10 ); | 39 | void showCharacter( QIMPenChar *, int speed = 10 ); |
40 | virtual QSize sizeHint(); | 40 | virtual QSize sizeHint() const; |
41 | 41 | ||
42 | public slots: | 42 | public slots: |
43 | void removeStroke(); | 43 | void removeStroke(); |
44 | 44 | ||
45 | signals: | 45 | signals: |
46 | void changeCharSet( QIMPenCharSet *cs ); | 46 | void changeCharSet( QIMPenCharSet *cs ); |
47 | void changeCharSet( int ); | 47 | void changeCharSet( int ); |
48 | void beginStroke(); | 48 | void beginStroke(); |
49 | void stroke( QIMPenStroke *ch ); | 49 | void stroke( QIMPenStroke *ch ); |
50 | 50 | ||
51 | protected slots: | 51 | protected slots: |
52 | void timeout(); | 52 | void timeout(); |
53 | 53 | ||
54 | protected: | 54 | protected: |
55 | enum Mode { Waiting, Input, Output }; | 55 | enum Mode { Waiting, Input, Output }; |
56 | bool selectSet( QPoint ); | 56 | bool selectSet( QPoint ); |
57 | virtual void mousePressEvent( QMouseEvent *e ); | 57 | virtual void mousePressEvent( QMouseEvent *e ); |
58 | virtual void mouseReleaseEvent( QMouseEvent *e ); | 58 | virtual void mouseReleaseEvent( QMouseEvent *e ); |
59 | virtual void mouseMoveEvent( QMouseEvent *e ); | 59 | virtual void mouseMoveEvent( QMouseEvent *e ); |
60 | virtual void paintEvent( QPaintEvent *e ); | 60 | virtual void paintEvent( QPaintEvent *e ); |
61 | virtual void resizeEvent( QResizeEvent *e ); | 61 | virtual void resizeEvent( QResizeEvent *e ); |
62 | 62 | ||
63 | struct CharSetEntry { | 63 | struct CharSetEntry { |
64 | QIMPenCharSet *cs; | 64 | QIMPenCharSet *cs; |
65 | int stretch; | 65 | int stretch; |
66 | }; | 66 | }; |
67 | typedef QList<CharSetEntry> CharSetEntryList; | 67 | typedef QList<CharSetEntry> CharSetEntryList; |
68 | typedef QListIterator<CharSetEntry> CharSetEntryIterator; | 68 | typedef QListIterator<CharSetEntry> CharSetEntryIterator; |
69 | 69 | ||
70 | protected: | 70 | protected: |
71 | Mode mode; | 71 | Mode mode; |
72 | bool autoHide; | 72 | bool autoHide; |