[Interest] Constructor of QPrinter takes 25-50 seconds to execute

Syam Krishnan syamcr at gmail.com
Wed Nov 25 18:15:31 CET 2015


I was testing an application of ours on Fedora 23 (x86-64) with Qt 4.8.7 
and found that the startup is delayed by 40 seconds or more.

The culprit seems to be QPrinter. Just creating a QPrinter object takes 
anywhere between 25 to 50 seconds!
I have attached a minimal example program. I used the a Qt Creator 
template so it has created a ui file for mainwindow. Do ignore that 
extra code.

The code in question is in the mainwindow constructor:

qDebug() << "Using Qt version: " << qVersion();
qDebug() << "before create printer" << QTime::currentTime();
QPrinter *qp = new QPrinter(QPrinter::ScreenResolution);
qDebug() << "after create printer" << QTime::currentTime();
delete qp;
qDebug() << "after delete printer" << QTime::currentTime();


A typical run gave me about 50 seconds between printing of "before 
create.." and "after create.." lines. I tried it several times and I got 
anywhere between 25 to 50 seconds.


I restarted the computer for some other reason, and now everything seems 
to be alright. The constructor finishes in no time and everything works 
as expected.

I am wondering if this problem can happen again. What can possibly cause 
QPrinter constructor to get stuck for such a long time?



Thanks and regards,

Syam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: qprinter.tar.gz
Type: application/gzip
Size: 3710 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151125/e59346c0/attachment.gz>


More information about the Interest mailing list