Splatify - I don't know how other folks print, but I am printing labels like this:
QFont printFont
("courier",
10);
printFont.setFixedPitch(TRUE);
painter.setPen(Qt::black);
painter.setFont(printFont);
int x = 1;
int y = 20;
for (int i = 0; i < list.size(); i++)
{
painter.drawText(x, y, list[i]);
y = y + 15;
}
QFont printFont("courier", 10);
printFont.setFixedPitch(TRUE);
QPainter painter(&printer);
painter.setPen(Qt::black);
painter.setFont(printFont);
int x = 1;
int y = 20;
for (int i = 0; i < list.size(); i++)
{
painter.drawText(x, y, list[i]);
y = y + 15;
}
To copy to clipboard, switch view to plain text mode
The list is built from a database query by appending the query values to a QStingList. It works fine for me. You should be able to use the same type of code by just appending whatever you need to your list.
This code comes after my call to the QPrintDialog.
Bookmarks