Monday 15 August 2011

c++ - Closing an external application with qt -


How do I open an application that was opened in Qt C ++ with QDesktopServices :: OpenURL Can i stop Because I have to update the text in PDF, which I have already opened at one point outside my application.

  QPrinter Printer (QPrinter :: HighResolution); Printer.setOutputFormat (QPrinter :: pdfFormat); Printer.setOutputFileName ("file.pdf"); Doc.print (& printer); // Doc QTextDocument QDesktopServices :: openUrl (Kural ("file.pdf"));   

And I would also like to know the difference between QDesktopServices :: OpenURL and Qt :: openUrlExternally and basically the To use .

You can not close external applications opened by QDesktopServices :: OpenURL . There is no such option, and this method does not provide any information about the process of starting which can be used to close it.

You can use the basic C ++ platform-based function to determine the path of the PDF viewer executable. After this, you can use QProcess to launch it. Then can be used to stop using kill () and end () .

Qt :: openUrlExternally may be used in the QML code, and QDesktopServices :: OpenURL should be used in C ++ code Could. This is the only difference I've read the Qt :: openUrlExternally source, calls it to QDesktopServices :: OpenURL internally.

No comments:

Post a Comment