From 2f4d68e9a4f775e279a92b73c26ecf8422da5ca6 Mon Sep 17 00:00:00 2001 From: Michael Winkelmann Date: Tue, 20 Nov 2018 13:47:58 +0100 Subject: [PATCH] Microseconds delay --- main.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 7a8a147..a986863 100644 --- a/main.cpp +++ b/main.cpp @@ -24,7 +24,8 @@ int main(int ac, char *av[]) { {{"output", "o"}, "Output PDF file", "output", "output.pdf"}, {{"importpath", "I"}, "QML import path", "importpath" }, {{"show-pdf", "p"}, "Show PDF file", "show-qml" }, - {{"show-qml", "q"}, "Show QML Output", "show-pdf" } + {{"show-qml", "q"}, "Show QML Output", "show-pdf" }, + {{"delay", "D"}, "Delay in milliseconds", "delay", "0" } }); parser.process(app); @@ -33,6 +34,7 @@ int main(int ac, char *av[]) { auto outputPdf = parser.value("output"); auto showPdf = parser.isSet("show-pdf"); auto showQml = parser.isSet("show-qml"); + auto delay = parser.value("delay").toInt(); QDir outputPdfDir; @@ -57,8 +59,7 @@ int main(int ac, char *av[]) { if (showQml) view->show(); - - QTimer::singleShot(10000,[=]() { + QTimer::singleShot(delay,[=]() { QmlPrinter printer; qInfo() << QObject::tr("Writing PDF to %1").arg(outputPdfDir.absolutePath()); -- GitLab