summaryrefslogtreecommitdiff
path: root/inputmethods/handwriting/qimpenwordpick.cpp
Unidiff
Diffstat (limited to 'inputmethods/handwriting/qimpenwordpick.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/handwriting/qimpenwordpick.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/inputmethods/handwriting/qimpenwordpick.cpp b/inputmethods/handwriting/qimpenwordpick.cpp
index 8ee103d..39745c6 100644
--- a/inputmethods/handwriting/qimpenwordpick.cpp
+++ b/inputmethods/handwriting/qimpenwordpick.cpp
@@ -59,55 +59,55 @@ int QIMPenWordPick::onWord( QPoint p )
59 if ( x + w > width() ) 59 if ( x + w > width() )
60 break; 60 break;
61 if ( p.x() > x-2 && p.x() < x + w + 2 ) 61 if ( p.x() > x-2 && p.x() < x + w + 2 )
62 return idx; 62 return idx;
63 x += w + 5; 63 x += w + 5;
64 if ( !idx ) 64 if ( !idx )
65 x += 3; 65 x += 3;
66 idx++; 66 idx++;
67 } 67 }
68 68
69 return -1; 69 return -1;
70} 70}
71 71
72void QIMPenWordPick::paintEvent( QPaintEvent * ) 72void QIMPenWordPick::paintEvent( QPaintEvent * )
73{ 73{
74 QPainter p(this); 74 QPainter p(this);
75 int x = 2; 75 int x = 2;
76 int h = p.fontMetrics().ascent() + 1; 76 int h = p.fontMetrics().ascent() + 1;
77 int idx = 0; 77 int idx = 0;
78 for ( QStringList::Iterator it = words.begin(); it != words.end(); ++it ) { 78 for ( QStringList::Iterator it = words.begin(); it != words.end(); ++it ) {
79 QString word = *it; 79 QString word = *it;
80 int w = p.fontMetrics().width( word ); 80 int w = p.fontMetrics().width( word );
81 if ( x + w > width() ) 81 if ( x + w > width() )
82 break; 82 break;
83 if ( idx == clickWord ) { 83 if ( idx == clickWord ) {
84 p.fillRect( x, 0, w, height(), black ); 84 p.fillRect( x, 0, w, height(), black );
85 p.setPen( white ); 85 p.setPen( white );
86 } else { 86 } else {
87 p.setPen( colorGroup().text() ); 87 p.setPen( colorGroup().text() );
88 } 88 }
89 p.drawText( x, h, word ); 89 p.drawText( x, h, word );
90 x += w + 5; 90 x += w + 5;
91 if ( !idx ) 91 if ( !idx )
92 x += 3; 92 x += 3;
93 idx++; 93 idx++;
94 } 94 }
95} 95}
96 96
97void QIMPenWordPick::mousePressEvent( QMouseEvent *e ) 97void QIMPenWordPick::mousePressEvent( QMouseEvent *e )
98{ 98{
99 clickWord = onWord( e->pos() ); 99 clickWord = onWord( e->pos() );
100 repaint(); 100 repaint();
101} 101}
102 102
103void QIMPenWordPick::mouseReleaseEvent( QMouseEvent *e ) 103void QIMPenWordPick::mouseReleaseEvent( QMouseEvent *e )
104{ 104{
105 int wordIdx = onWord( e->pos() ); 105 int wordIdx = onWord( e->pos() );
106 if ( wordIdx >= 0 && wordIdx == clickWord ) { 106 if ( wordIdx >= 0 && wordIdx == clickWord ) {
107 //qDebug( "Clicked %s", words[wordIdx].latin1() ); 107 //odebug << "Clicked " << words[wordIdx].latin1() << oendl;
108 emit wordClicked( words[wordIdx] ); 108 emit wordClicked( words[wordIdx] );
109 } 109 }
110 clickWord = -1; 110 clickWord = -1;
111 repaint(); 111 repaint();
112} 112}
113 113