ich habe ein Problem mit der Methode drawText().
Auf meinem PC funktioniert meine WritePDF Methode ohne Probleme. Auf dem Server schmiert diese jedoch immer beim Aufruf von DrawText() ab. Aktuell geh ich von einem Bug in QT4.2.1 aus, kann jedoch nicht auf die neue Version updaten.
Unten habe ich den Code gepostet. Eventuell kann mir jemand eine Lösung sagen, die funktioniert.
(pp->drawText(x, y, temp);) ist die stelle, wo er immer abschmiert. Allerdings, wenn ich drawText mit drawPoint ersetzt, gehts...
Code: Alles auswählen
int x = 0;
int y = 0;
bool aligRight = false;
double resFactor = 4;
double stXFactor = 100;
double stYFactor = 100;
QString temp;
QPainter *pp = new QPainter(my_printer);
pp->setRenderHint(QPainter::TextAntialiasing);
QRect rect = pp->viewport();
pp->setViewport(0,0, rect.width(), rect.height());
my_font = QFont("Arial", 11);
pp->setFont(my_font);
my_font.setBold(false);
QChar alignment;
for (int i = 0; i < my_list.count(); i++)
{
temp = my_list.at(i);
if (temp.contains("New Page"))
{
my_printer->newPage();
}
else
{
if (temp.count() > 13)
{
aligRight = false;
x = temp.mid(0,4).toInt();
y = temp.mid(4,4).toInt();
x = x * resFactor - stXFactor;
y = y * resFactor - stYFactor;
if (temp.at(9) == 'B')
my_font.setBold(true);
else
if (temp.at(12) == 'R')
aligRight = true;
if (temp.at(8) == 'L')
{
pp->setFont(my_font);
temp.clear();
while (temp.length() < 134)
temp.append("-");
pp->drawText(x, y, temp);
}
else if (temp.at(8) == 'F') // Funktion Schrift
{
temp = temp.mid(13, temp.length()-13);
pp->setFont(my_font);
if (aligRight)
{
pp->drawText(x-78, y-17, 200, 17, Qt::AlignRight, temp);
}
else
{
pp->drawText(x, y, temp);
}
}
}
}
}
pp->end();
delete pp;
qDebug() << "-- END PDF";
return 0;