2

I'm using Qt for iOS 5.2 and when trying to draw text using QPainter, it will hang on that call for a few seconds (5 seconds on iPhone4 and around 3 on OSX). After that first time, it won't block anymore if I call it again.

QImage image(QSize(200, 200), QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
QPainter painter(&image);
QPen pen(d->textColor);
painter.setPen(pen);
QFont font(d->fontFamily, d->fontSize);
painter.setFont(font);
qDebug() << "Before draw text";
painter.drawText(QRect(0, 0, 200, 200), flags, d->text); //Blocking call
qDebug() << "After draw text";

I'm using the same example in Windows(Qt5.1) and I've never had any problems, this same code runs smoothly.

I had to execute that code in another thread so it won't block the application, but most likely I'll need to see text as soon as the application is launched. I've tested with QStaticText as well with no luck.

Is anyone experiencing the same problem? Is there any workaround?

EiN
  • 121
  • 1
  • 6
  • Most likely it's a Qt bug to do with font database management. I suggest creating a testcase and submitting it. – Kuba hasn't forgotten Monica Mar 06 '14 at 12:16
  • 2
    Thank you for your suggestion. For anyone interested, here is the link for the bug tracker: [https://bugreports.qt-project.org/browse/QTBUG-37336](https://bugreports.qt-project.org/browse/QTBUG-37336) – EiN Mar 10 '14 at 10:23

0 Answers0