<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Qt5.4.1 Windows7 QProcess [SOLVED]]]></title><description><![CDATA[<p dir="auto">Hello everyone.<br />
I am trying to start the pdf viewer (adobe for windows and evince for linux) from within my program.<br />
The problem is that on Linux works while on windows does not start, or better, the viewer does not appear.<br />
This below is my code:</p>
<p dir="auto">*void FormMetodi::on_pushButton_4_clicked()<br />
{<br />
QString program ;<br />
#ifdef Q_OS_LINUX<br />
program = "evince";<br />
#endif<br />
#ifdef Q_OS_WIN<br />
program = "acrord32.exe";<br />
#endif</p>
<pre><code> QStringList Parameters;
 Parameters&lt;&lt;ui-&gt;tableMetodi-&gt;item(ui-&gt;tableMetodi-&gt;currentRow(),3)-&gt;text();

 QProcess *myProcess = new QProcess();
 // Start the QProcess instance.

 myProcess-&gt;start(program,Parameters);

 if(myProcess-&gt;waitForStarted()){
     qDebug() &lt;&lt; "Starting";
 }

 if(myProcess-&gt;Running){
     qDebug() &lt;&lt; "Running";
 }

 myProcess-&gt;waitForFinished(-1);
 myProcess-&gt;close();

 qDebug() &lt;&lt; myProcess-&gt;isOpen();
 qDebug() &lt;&lt; myProcess-&gt;ReadError;
 qDebug() &lt;&lt; program;
 qDebug() &lt;&lt; Parameters;
</code></pre>
<p dir="auto">}</p>
<p dir="auto">The debug outpt is :<br />
Running<br />
false<br />
3<br />
"acrord32.exe"<br />
("C:/Users/franaria/Desktop/integrativo-2014-1.pdf")</p>
<p dir="auto">On Windows, I also tried QDesktopServices but the problem here is that if there are spaces in the path, or the path refers to a network drive does not work.</p>
<p dir="auto">QDesktopServices::openUrl(QUrl(ui-&gt;tableMetodi-&gt;item(ui-&gt;tableMetodi-&gt;currentRow(),3)-&gt;text(), QUrl::TolerantMode));</p>
<p dir="auto">What is the best method to launch an external application? And above all, where am I doing wrong?<br />
Thanks to all</p>
]]></description><link>https://forum.qt.io/topic/52415/qt5-4-1-windows7-qprocess-solved</link><generator>RSS for Node</generator><lastBuildDate>Thu, 08 Oct 2026 15:43:53 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/52415.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Mar 2015 11:26:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Sat, 21 Mar 2015 11:21:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/chris-kawa">@<bdi>Chris-Kawa</bdi></a> said:</p>
<blockquote>
<p dir="auto">No. I just said you shouldn't! Not all users have it installed in that path and not all users even have drive C:.<br />
Stick with the QDesktopServices.</p>
</blockquote>
<p dir="auto">I understand that isn't the correct approach but I want to do a test with QProcess to learn to use it.<br />
In my program I will use , obviously , QDesktopServices :: OpenURL.<br />
Again thanks for the help Chris-Kawa</p>
]]></description><link>https://forum.qt.io/post/266276</link><guid isPermaLink="true">https://forum.qt.io/post/266276</guid><dc:creator><![CDATA[panoramix]]></dc:creator><pubDate>Sat, 21 Mar 2015 11:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 23:00:41 GMT]]></title><description><![CDATA[<p dir="auto">No. I just said you shouldn't! Not all users have it installed in that path and not all users even have drive C:.<br />
Stick with the QDesktopServices.</p>
]]></description><link>https://forum.qt.io/post/266243</link><guid isPermaLink="true">https://forum.qt.io/post/266243</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Fri, 20 Mar 2015 23:00:41 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 22:41:47 GMT]]></title><description><![CDATA[<p dir="auto">It also works well on Linux.<br />
Thanks Chris Kawa I'll try using the full path.<br />
Good weekend to everyone</p>
]]></description><link>https://forum.qt.io/post/266242</link><guid isPermaLink="true">https://forum.qt.io/post/266242</guid><dc:creator><![CDATA[panoramix]]></dc:creator><pubDate>Fri, 20 Mar 2015 22:41:47 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 15:33:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/panoramix">@<bdi>panoramix</bdi></a> said:</p>
<blockquote>
<p dir="auto">In any case in Windows I was not able to launch an application with gui using qprocess. :-(</p>
</blockquote>
<p dir="auto">That's because of what I said. Either the app needs to be in the PATH/system directory or you need to specify the full path e.g. "C:/Program Files (x86)/Adobe/Reader 11.0/Reader/AcroRd32.exe". Of course the full path is impractical and messing with the PATH is plain evil so QDesktopServices is definitely the "right thing to do" and the way to go.</p>
]]></description><link>https://forum.qt.io/post/266218</link><guid isPermaLink="true">https://forum.qt.io/post/266218</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Fri, 20 Mar 2015 15:33:07 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 14:09:19 GMT]]></title><description><![CDATA[<p dir="auto">Hi</p>
<p dir="auto">SOLVED</p>
<p dir="auto">Instead of using:<br />
QDesktopServices::openUrl(QUrl(ui-&gt;tableMetodi-&gt;item(ui-&gt;tableMetodi-&gt;currentRow(),3)-&gt;text(), QUrl::TolerantMode));</p>
<p dir="auto">I used this<br />
QDesktopServices::openUrl(QUrl::fromLocalFile(ui-&gt;tableMetodi-&gt;item(ui-&gt;tableMetodi-&gt;currentRow(),3)-&gt;text()));</p>
<p dir="auto">The difference is in <strong>QUrl::fromLocalFile</strong></p>
<p dir="auto">In this way I can open the pdf from both local disk that shared disk and I have no more problems with spaces in the name of the file or directory.<br />
This evening I will try also on Linux so I will be able to tell you if I get the same behavior.</p>
<p dir="auto">Thank you all.</p>
<p dir="auto">In any case in Windows I was not able to launch an application with gui using qprocess. :-(</p>
]]></description><link>https://forum.qt.io/post/266212</link><guid isPermaLink="true">https://forum.qt.io/post/266212</guid><dc:creator><![CDATA[panoramix]]></dc:creator><pubDate>Fri, 20 Mar 2015 14:09:19 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 12:54:09 GMT]]></title><description><![CDATA[<p dir="auto">It might be better to use the default application to open the file.</p>
<p dir="auto">In OS X you use the open command (i.e. open name_of_file.pdf).  In GNU/Linux the command is 'xdg-open' and on Windows it would be 'start' (?).  I have also read that in Windows you can simply pass the name of the file to run and if it is a non executable it will automatically open with the default application (I don't know if this is true or what conditions are required).  The Windows one might require you open a console (cmd.exe) with the start command.  Don't know about the Windows version of this but I am sure it can be done.</p>
]]></description><link>https://forum.qt.io/post/266198</link><guid isPermaLink="true">https://forum.qt.io/post/266198</guid><dc:creator><![CDATA[Rondog]]></dc:creator><pubDate>Fri, 20 Mar 2015 12:54:09 GMT</pubDate></item><item><title><![CDATA[Reply to Qt5.4.1 Windows7 QProcess [SOLVED] on Fri, 20 Mar 2015 11:59:57 GMT]]></title><description><![CDATA[<p dir="auto">QProcess will only work like that if "acrord32.exe" is in a system discoverable location e.g. PATH environment variable or one of the system directories. That is almost never the case on users machines.</p>
<p dir="auto">QDesktopServices should work in this case fine. It can also handle spaces. Can you give an example of a path that doesn't work?</p>
]]></description><link>https://forum.qt.io/post/266191</link><guid isPermaLink="true">https://forum.qt.io/post/266191</guid><dc:creator><![CDATA[Chris Kawa]]></dc:creator><pubDate>Fri, 20 Mar 2015 11:59:57 GMT</pubDate></item></channel></rss>