QPainter::drawText cost 500ms to run
-
Hi, all
I have a problem. I use QPainter::drawText in QWidget::paintEvent. But, after I set font, the drawText function will cost about 500ms to run at the first time. Then it runs quickly , less then 5ms.
I use drawText(const QRect & rectangle, int flags, const QString & text, QRect * boundingRect = 0).
Qt version 5.9.6So, please help me. How can I draw text normal quickly.
-
Hi, all
I have a problem. I use QPainter::drawText in QWidget::paintEvent. But, after I set font, the drawText function will cost about 500ms to run at the first time. Then it runs quickly , less then 5ms.
I use drawText(const QRect & rectangle, int flags, const QString & text, QRect * boundingRect = 0).
Qt version 5.9.6So, please help me. How can I draw text normal quickly.
-
I just use C:\Windows\Fonts\msyh.tff font and set QFont::setPixelSize(25).
If I don't set font, 'drawText' run fast. I don't know why.
I have searched the solution for a week now, but I have no result.
I used 5.9.0 before, and I update to 5.9.6 today. But don't fix it -
Try adding the font to the database in advance: http://doc.qt.io/qt-5/qfontdatabase.html#addApplicationFont