summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Side-by-side diff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp19
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
@@ -174,13 +174,13 @@ 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);
- QPixmap *pix = keys->pix(row,col);
+ QImage *pix = keys->pix(row,col);
ushort c = keys->uni(row, col);
p.setPen(textcolor);
if (!pix) {
if (shift || lock)
@@ -192,13 +192,13 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
p.drawText(x, y,
defaultKeyWidth * keyWidth + 3, keyHeight,
AlignCenter, (QChar)c);
}
else
// center the image in the middle of the key
- p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2,
+ p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2,
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);
@@ -216,13 +216,13 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
p.setPen(keycolor_lines);
p.drawLine(x, y, x + width(), y);
for (int col = 0; col < keys->numKeys(row); col++) {
- QPixmap *pix = keys->pix(row, col);
+ QImage *pix = keys->pix(row, col);
int keyWidth = keys->width(row, col);
int keyWidthPix = defaultKeyWidth * keyWidth;
if (keys->pressed(row, col))
@@ -241,15 +241,16 @@ void Keyboard::drawKeyboard(QPainter &p, int row, int col)
p.drawText(x, y,
keyWidthPix + 3, keyHeight,
AlignCenter, (QChar)c);
}
else {
// center the image in the middle of the key
- p.drawPixmap( x + (keyWidthPix - pix->width())/2,
+ pix->setColor(1, textcolor.rgb());
+ p.drawImage( x + (keyWidthPix - pix->width())/2,
y + (keyHeight - pix->height())/2 + 1,
- QPixmap(*pix) );
+ QImage(*pix) );
}
p.setPen(keycolor_lines);
p.drawLine(x, y, x, y + keyHeight);
x += keyWidthPix;
@@ -1041,13 +1042,13 @@ void Keys::setKeysFromFile(const char * filename) {
int qcode;
ushort unicode;
int width;
QString buf;
QString comment;
char * xpm[256]; //couldnt be larger than that... could it?
- QPixmap *xpm2pix = 0;
+ QImage *xpm2pix = 0;
buf = t.readLine();
while (buf) {
// get rid of comments
buf.replace(QRegExp("#.*$", FALSE, FALSE), "");
@@ -1087,13 +1088,13 @@ void Keys::setKeysFromFile(const char * filename) {
xpmLineCount++;
buf = t.readLine();
}
if (xpmLineCount) {
- xpm2pix = new QPixmap((const char **)xpm);
+ xpm2pix = new QImage((const char **)xpm);
for (int i = 0; i < xpmLineCount; i++)
delete [] (xpm[i]);
}
setKey(row, qcode, unicode, width, xpm2pix);
@@ -1156,13 +1157,13 @@ void Keys::setKeysFromFile(const char * filename) {
}
}
// Keys::setKey {{{2
void Keys::setKey(const int row, const int qcode, const ushort unicode,
- const int width, QPixmap *pix) {
+ const int width, QImage *pix) {
Key * key;
key = new Key;
key->qcode = qcode;
key->unicode = unicode;
key->width = width;
@@ -1213,13 +1214,13 @@ ushort Keys::uni(const int row, const int col) {
int Keys::qcode(const int row, const int col) {
return keys[row].at(col)->qcode;
}
-QPixmap *Keys::pix(const int row, const int col) {
+QImage *Keys::pix(const int row, const int col) {
return keys[row].at(col)->pix;
}
bool Keys::pressed(const int row, const int col) {