-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index c3ee8f3..92ea896 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp @@ -173,49 +173,49 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) int keyWidth = keys->width(row, col); p.fillRect(x + 1, y + 1, keyWidth * defaultKeyWidth - 1, keyHeight - 1, pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); QImage *pix = keys->pix(row,col); ushort c = keys->uni(row, col); p.setPen(textcolor); if (!pix) { if (shift || lock) c = keys->shift(c); if (meta) { c = keys->meta(c); } p.drawText(x, y, defaultKeyWidth * keyWidth + 3, keyHeight, AlignCenter, (QChar)c); } else // center the image in the middle of the key - p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2, + p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, y + (keyHeight - pix->height())/2 + 1, *pix ); // this fixes the problem that the very right end of the board's vertical line // gets painted over, because it's one pixel shorter than all other keys p.setPen(keycolor_lines); p.drawLine(width() - 1, 0, width() - 1, height()); } else { p.fillRect(0, 0, width(), height(), keycolor); for (row = 1; row <= 5; row++) { int x = 0; int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); p.setPen(keycolor_lines); p.drawLine(x, y, x + width(), y); for (int col = 0; col < keys->numKeys(row); col++) { QImage *pix = keys->pix(row, col); @@ -223,49 +223,49 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col) int keyWidthPix = defaultKeyWidth * keyWidth; if (keys->pressed(row, col)) p.fillRect(x+1, y+1, keyWidthPix - 1, keyHeight - 1, keycolor_pressed); ushort c = keys->uni(row, col); p.setPen(textcolor); if (!pix) { if ((shift || lock) && keys->shift(c)) c = keys->shift(c); else if (meta && keys->meta(c)) c = keys->meta(c); p.drawText(x, y, keyWidthPix + 3, keyHeight, AlignCenter, (QChar)c); } else { // center the image in the middle of the key pix->setColor(1, textcolor.rgb()); - p.drawImage( x + (keyWidthPix - pix->width())/2, + p.drawImage( x + (keyWidthPix - pix->width())/2 + 1, y + (keyHeight - pix->height())/2 + 1, QImage(*pix) ); } p.setPen(keycolor_lines); p.drawLine(x, y, x, y + keyHeight); x += keyWidthPix; } } p.setPen(keycolor_lines); p.drawLine(0, height() - 1, width(), height() - 1); p.drawLine(width() - 1, 0, width() - 1, height()); } } /* Keyboard::mousePressEvent {{{1 */ void Keyboard::mousePressEvent(QMouseEvent *e) { int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; |