<?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[QPushButton that run external app]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have a quick question. I created a QPushButton called  extapp_btn.<br />
Now I want to connect it with an external app. In my example bellow<br />
I push the button and notepad.exe should start.</p>
<p dir="auto">How can I connect them?</p>
<p dir="auto">-example code ----------------------------------</p>
<p dir="auto">#include "mainwindow.h"<br />
#include "ui_mainwindow.h"<br />
#include &lt;QWebView&gt;<br />
#include &lt;QUrl&gt;<br />
#include &lt;QPushButton&gt;<br />
#include &lt;QProcess&gt;</p>
<p dir="auto">MainWindow::MainWindow(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::MainWindow)<br />
{<br />
ui-&gt;setupUi(this);<br />
ui-&gt;webView-&gt;load(QUrl("<a href="http://localhost" target="_blank" rel="noopener noreferrer nofollow ugc">http://localhost</a>"));</p>
<pre><code>QPushButton * extapp_btn = new QPushButton(this);
extapp_btn-&gt;setGeometry(540,440,93,27);
extapp_btn-&gt;setText("External App");
</code></pre>
<p dir="auto">QProcess *proc = new QProcess (this);<br />
// proc-&gt;start ("notepad.exe");</p>
<p dir="auto">QObject::connect(extapp_btn_btn,SIGNAL(clicked()),qApp,SLOT( START EXTERNAL APP ));</p>
<p dir="auto">}</p>
<h2>MainWindow::~MainWindow()<br />
{<br />
delete ui;<br />
}</h2>
]]></description><link>https://forum.qt.io/topic/90099/qpushbutton-that-run-external-app</link><generator>RSS for Node</generator><lastBuildDate>Mon, 04 May 2026 09:11:57 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/90099.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Apr 2018 15:37:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QPushButton that run external app on Wed, 25 Apr 2018 22:17:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/gojir4">@<bdi>Gojir4</bdi></a> said in <a href="/post/454822">QPushButton that run external app</a>:</p>
<blockquote>
<p dir="auto">Hi,</p>
<p dir="auto">You can even give the file to be opened in arguments :</p>
<pre><code>QProcess::startDetached("notepad++",  QStringList() &lt;&lt; "path/to/the/file.txt");
</code></pre>
</blockquote>
<p dir="auto">Thanks for the help. much appreciated</p>
]]></description><link>https://forum.qt.io/post/454906</link><guid isPermaLink="true">https://forum.qt.io/post/454906</guid><dc:creator><![CDATA[AZimmerer]]></dc:creator><pubDate>Wed, 25 Apr 2018 22:17:57 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton that run external app on Wed, 25 Apr 2018 16:28:34 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">You can even give the file to be opened in arguments :</p>
<pre><code>QProcess::startDetached("notepad++",  QStringList() &lt;&lt; "path/to/the/file.txt");
</code></pre>
]]></description><link>https://forum.qt.io/post/454822</link><guid isPermaLink="true">https://forum.qt.io/post/454822</guid><dc:creator><![CDATA[Gojir4]]></dc:creator><pubDate>Wed, 25 Apr 2018 16:28:34 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton that run external app on Wed, 25 Apr 2018 15:16:49 GMT]]></title><description><![CDATA[<p dir="auto">thank you very much. worked like a charm :D</p>
]]></description><link>https://forum.qt.io/post/454808</link><guid isPermaLink="true">https://forum.qt.io/post/454808</guid><dc:creator><![CDATA[AZimmerer]]></dc:creator><pubDate>Wed, 25 Apr 2018 15:16:49 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton that run external app on Tue, 24 Apr 2018 06:06:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/azimmerer">@<bdi>AZimmerer</bdi></a></p>
<p dir="auto">You should read this<br />
<a href="http://doc.qt.io/qt-5/signalsandslots.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.io/qt-5/signalsandslots.html</a></p>
<p dir="auto">Anyway, you need to add slot to mainwin.</p>
<p dir="auto">class MainWindow : public QMainWindow<br />
{<br />
Q_OBJECT<br />
....<br />
private slots:  // this you might to write too<br />
void StartApp(); // this is the slot. a normal function<br />
..</p>
<p dir="auto">and in mainwindow.cpp<br />
void MainWindow::StartApp() {<br />
QProcess::startDetached("notepad.exe");<br />
}</p>
<p dir="auto">then<br />
QObject::connect(extapp_btn_btn,SIGNAL(clicked()),this,SLOT( StartApp()));</p>
]]></description><link>https://forum.qt.io/post/454499</link><guid isPermaLink="true">https://forum.qt.io/post/454499</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Tue, 24 Apr 2018 06:06:46 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton that run external app on Tue, 24 Apr 2018 01:44:06 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for helping me out. I am complete noob. So what I want to do is. If I click on the button „extapp_btn“ notpad should start. How do I have to modify my code?</p>
]]></description><link>https://forum.qt.io/post/454489</link><guid isPermaLink="true">https://forum.qt.io/post/454489</guid><dc:creator><![CDATA[AZimmerer]]></dc:creator><pubDate>Tue, 24 Apr 2018 01:44:06 GMT</pubDate></item><item><title><![CDATA[Reply to QPushButton that run external app on Mon, 23 Apr 2018 15:47:34 GMT]]></title><description><![CDATA[<p dir="auto">Well just put the QProcess code into<br />
START EXTERNAL APP slot ?<br />
Or do u ask how to make slot ?<br />
Also you say that qApp has the slot.<br />
Dont you mean "this" for mainwidow ?</p>
]]></description><link>https://forum.qt.io/post/454415</link><guid isPermaLink="true">https://forum.qt.io/post/454415</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Mon, 23 Apr 2018 15:47:34 GMT</pubDate></item></channel></rss>