Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index e3d3928..3f6f73b 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -176,9 +176,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
176 | p.fillRect(x + 1, y + 1, | 176 | p.fillRect(x + 1, y + 1, |
177 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, | 177 | keyWidth * defaultKeyWidth - 1, keyHeight - 1, |
178 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); | 178 | pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); |
179 | 179 | ||
180 | QPixmap *pix = keys->pix(row,col); | 180 | QImage *pix = keys->pix(row,col); |
181 | 181 | ||
182 | ushort c = keys->uni(row, col); | 182 | ushort c = keys->uni(row, col); |
183 | 183 | ||
184 | p.setPen(textcolor); | 184 | p.setPen(textcolor); |
@@ -194,9 +194,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
194 | AlignCenter, (QChar)c); | 194 | AlignCenter, (QChar)c); |
195 | } | 195 | } |
196 | else | 196 | else |
197 | // center the image in the middle of the key | 197 | // center the image in the middle of the key |
198 | p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, | 198 | p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2, |
199 | y + (keyHeight - pix->height())/2 + 1, | 199 | y + (keyHeight - pix->height())/2 + 1, |
200 | *pix ); | 200 | *pix ); |
201 | 201 | ||
202 | // this fixes the problem that the very right end of the board's vertical line | 202 | // this fixes the problem that the very right end of the board's vertical line |
@@ -218,9 +218,9 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
218 | p.drawLine(x, y, x + width(), y); | 218 | p.drawLine(x, y, x + width(), y); |
219 | 219 | ||
220 | for (int col = 0; col < keys->numKeys(row); col++) { | 220 | for (int col = 0; col < keys->numKeys(row); col++) { |
221 | 221 | ||
222 | QPixmap *pix = keys->pix(row, col); | 222 | QImage *pix = keys->pix(row, col); |
223 | int keyWidth = keys->width(row, col); | 223 | int keyWidth = keys->width(row, col); |
224 | 224 | ||
225 | 225 | ||
226 | int keyWidthPix = defaultKeyWidth * keyWidth; | 226 | int keyWidthPix = defaultKeyWidth * keyWidth; |
@@ -243,11 +243,12 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) | |||
243 | AlignCenter, (QChar)c); | 243 | AlignCenter, (QChar)c); |
244 | } | 244 | } |
245 | else { | 245 | else { |
246 | // center the image in the middle of the key | 246 | // center the image in the middle of the key |
247 | p.drawPixmap( x + (keyWidthPix - pix->width())/2, | 247 | pix->setColor(1, textcolor.rgb()); |
248 | p.drawImage( x + (keyWidthPix - pix->width())/2, | ||
248 | y + (keyHeight - pix->height())/2 + 1, | 249 | y + (keyHeight - pix->height())/2 + 1, |
249 | QPixmap(*pix) ); | 250 | QImage(*pix) ); |
250 | } | 251 | } |
251 | 252 | ||
252 | p.setPen(keycolor_lines); | 253 | p.setPen(keycolor_lines); |
253 | p.drawLine(x, y, x, y + keyHeight); | 254 | p.drawLine(x, y, x, y + keyHeight); |
@@ -1043,9 +1044,9 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1043 | int width; | 1044 | int width; |
1044 | QString buf; | 1045 | QString buf; |
1045 | QString comment; | 1046 | QString comment; |
1046 | char * xpm[256]; //couldnt be larger than that... could it? | 1047 | char * xpm[256]; //couldnt be larger than that... could it? |
1047 | QPixmap *xpm2pix = 0; | 1048 | QImage *xpm2pix = 0; |
1048 | 1049 | ||
1049 | buf = t.readLine(); | 1050 | buf = t.readLine(); |
1050 | while (buf) { | 1051 | while (buf) { |
1051 | 1052 | ||
@@ -1089,9 +1090,9 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1089 | buf = t.readLine(); | 1090 | buf = t.readLine(); |
1090 | } | 1091 | } |
1091 | if (xpmLineCount) { | 1092 | if (xpmLineCount) { |
1092 | 1093 | ||
1093 | xpm2pix = new QPixmap((const char **)xpm); | 1094 | xpm2pix = new QImage((const char **)xpm); |
1094 | for (int i = 0; i < xpmLineCount; i++) | 1095 | for (int i = 0; i < xpmLineCount; i++) |
1095 | 1096 | ||
1096 | delete [] (xpm[i]); | 1097 | delete [] (xpm[i]); |
1097 | 1098 | ||
@@ -1158,9 +1159,9 @@ void Keys::setKeysFromFile(const char * filename) { | |||
1158 | } | 1159 | } |
1159 | 1160 | ||
1160 | // Keys::setKey {{{2 | 1161 | // Keys::setKey {{{2 |
1161 | void Keys::setKey(const int row, const int qcode, const ushort unicode, | 1162 | void Keys::setKey(const int row, const int qcode, const ushort unicode, |
1162 | const int width, QPixmap *pix) { | 1163 | const int width, QImage *pix) { |
1163 | 1164 | ||
1164 | Key * key; | 1165 | Key * key; |
1165 | key = new Key; | 1166 | key = new Key; |
1166 | key->qcode = qcode; | 1167 | key->qcode = qcode; |
@@ -1215,9 +1216,9 @@ int Keys::qcode(const int row, const int col) { | |||
1215 | 1216 | ||
1216 | return keys[row].at(col)->qcode; | 1217 | return keys[row].at(col)->qcode; |
1217 | } | 1218 | } |
1218 | 1219 | ||
1219 | QPixmap *Keys::pix(const int row, const int col) { | 1220 | QImage *Keys::pix(const int row, const int col) { |
1220 | 1221 | ||
1221 | return keys[row].at(col)->pix; | 1222 | return keys[row].at(col)->pix; |
1222 | 1223 | ||
1223 | } | 1224 | } |