// Draw colored tiles onto QImage
qImage = new QImage(new QSize((numCols + 1) * (tileSize + 1),
(numRows + 1) * (tileSize + 1)), Format.Format_RGB16);
QPainter painter = new QPainter(qImage);
painter.setPen(new QPen(QColor.black, lineWidth));
// Draw lines between tiles
for (int i = 0; i <= numCols; i++) {
painter.drawLine((i) * tileSize, tileSize, (i) * tileSize,
(numRows) * tileSize);
}