Create QPrinter is very slow under Qt5
Unsolved
General and Desktop
-
Hi everyone,
Why under Qt 5.5 the creation of QPrint object is very slow:This code
[code]
QElapsedTimer timer;
timer.start();
QPrinter printer;
qDebug() << "The operation took" << timer.elapsed() << "milliseconds";
[/code]Measured with QElapsedTimer, Output:
Qt4.8.7
The operation took **740 milliseconds **Qt5.5
The operation took 2391 millisecondsAmazing?!
-
Hi,
IMO your code is not correct. This should be the right way to measure the time
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QElapsedTimer timer; timer.start(); QPrinter printer; qint64 elapsed = timer.nsecsElapsed(); qDebug() << "Elapsed:" << elapsed << "ns"; return 0; }
because in your code
elapsed()
is called only after some output operations.Anyway, in my environment (Qt 5.5.1 on OS X) the output is always between 1.2 and 1.6 ms.
In which platform are you running that code? -