<?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[From QLineEdit Dialog to MainWindows]]></title><description><![CDATA[<p dir="auto">Hi!<br />
I've been looking everywhere for 2 days now to understand this but still I dont get it.<br />
I've a Dialog created with a .ui file and I have QLineEdit where I enter some input and I would like to take this input from the Dialog to the MainWindow.<br />
How can I do it?</p>
<p dir="auto">I tried different code and this is the last one I tried (written in the Dialog)-&gt; <code>connect(this-&gt;ui-&gt;cp_PM, SIGNAL(textEdited(QString)), MainWindow, SLOT(ui-&gt;glmF-&gt;setText(QString)));</code></p>
<p dir="auto">This is a code I found online and works just fine but I need something similar from a Dialog to MainWindow -&gt; <code>connect(this-&gt;ui-&gt;pmFV, SIGNAL(textEdited(QString)), ui-&gt;glmF, SLOT(setText(QString)));</code></p>
<p dir="auto">I tried looked at the doc in the Signal and Slot chapter, but it's not very clear</p>
]]></description><link>https://forum.qt.io/topic/139353/from-qlineedit-dialog-to-mainwindows</link><generator>RSS for Node</generator><lastBuildDate>Mon, 26 Oct 2026 00:26:26 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139353.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 16 Sep 2022 06:12:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 08:06:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<blockquote>
<p dir="auto">Do you think it is better/more efficient to spend a lot of time in a forum to get help for issues you would not have if you would learn the basics of the programming language you're using? You should really reconsider your approach...</p>
</blockquote>
<p dir="auto">I know, but as I said it's a project my boss gives me with a deadline in a week and they know I have little experience in C++; so i'm stuck here trying to build something with what I know and I found online</p>
]]></description><link>https://forum.qt.io/post/728946</link><guid isPermaLink="true">https://forum.qt.io/post/728946</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 08:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:41:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728941">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">I dont have actual time to learn c++ in a right way</p>
</blockquote>
<p dir="auto">Do you think it is better/more efficient to spend a lot of time in a forum to get help for issues you would not have if you would learn the basics of the programming language you're using? You should really reconsider your approach...</p>
<p dir="auto">struct is one of the most basic things in C++:</p>
<pre><code>struct Data
{
    QString data1;
    QString data2;
    ...
}

Data parametri::getValuePar()
{
    Data result;
    result.data1 = ui-&gt;pmFV-&gt;text();
    result.data2 = ui-&gt;glmF-&gt;text();
    ...
    return result;
}
</code></pre>
]]></description><link>https://forum.qt.io/post/728945</link><guid isPermaLink="true">https://forum.qt.io/post/728945</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:41:51 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:20:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728941">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">I dont have actual time to learn c++ in a right way;</p>
</blockquote>
<p dir="auto">Then you're wrong here.</p>
<blockquote>
<p dir="auto">And I repeat, this give me the output I wrote in my last comment, but not in the format I need</p>
</blockquote>
<p dir="auto">It does not compile since QLineEdit has not function <a href="https://doc.qt.io/qt-6/qlineedit.html#text-prop" target="_blank" rel="noopener noreferrer nofollow ugc">text()</a> which takes an integer.</p>
<p dir="auto">I'm out here.</p>
]]></description><link>https://forum.qt.io/post/728942</link><guid isPermaLink="true">https://forum.qt.io/post/728942</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:20:23 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:19:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> It gives me what I need in the wrong way<br />
I dont have actual time to learn c++ in a right way; this is a work project and give me this stuff to do knowing I know very little of c++</p>
<p dir="auto">And I repeat, this give me the output I wrote in my last comment, but not in the format I need</p>
<blockquote>
<p dir="auto">This does not even compile...</p>
</blockquote>
<p dir="auto">it was and example to let you understand the output for god sake, <strong>it's not my actual code</strong> if you have to answer pls at least try to understan what I'm writing</p>
]]></description><link>https://forum.qt.io/post/728941</link><guid isPermaLink="true">https://forum.qt.io/post/728941</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:19:42 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:13:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728937">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">QString pmFV =  ui-&gt;pmFV-&gt;text(123);<br />
QString glmF = ui-&gt;glmF-&gt;text(78);</p>
</blockquote>
<p dir="auto">This does not even compile...</p>
<p dir="auto">How about some c++ basics before starting with Qt</p>
<blockquote>
<p dir="auto">I actually dont know how to do that. It the right way I mean.</p>
</blockquote>
<p dir="auto">See e.g <a href="https://doc.qt.io/qt-5/qstring.html#append" target="_blank" rel="noopener noreferrer nofollow ugc">QString::append()</a></p>
]]></description><link>https://forum.qt.io/post/728939</link><guid isPermaLink="true">https://forum.qt.io/post/728939</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:13:24 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:11:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> I change it<br />
but the result is the two values united like these are the values:<br />
QString pmFV =  ui-&gt;pmFV-&gt;text(123);<br />
QString glmF = ui-&gt;glmF-&gt;text(78);</p>
<p dir="auto">and this is the output in qDebug() -&gt; 12378</p>
]]></description><link>https://forum.qt.io/post/728937</link><guid isPermaLink="true">https://forum.qt.io/post/728937</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:11:51 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:06:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a></p>
<blockquote>
<p dir="auto">create a structure where you put all these strings and implement a getter method which returns this struct.</p>
</blockquote>
<p dir="auto">I actually dont know how to do that. It the right way I mean. It's already been 2days i'm trying to have this :(</p>
]]></description><link>https://forum.qt.io/post/728936</link><guid isPermaLink="true">https://forum.qt.io/post/728936</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:06:43 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:08:26 GMT]]></title><description><![CDATA[<p dir="auto">@J-Hilk</p>
<blockquote>
<p dir="auto">You should have at least a warning about this in QtCreator.</p>
</blockquote>
<p dir="auto">I dont, because my MainWindow start and when I try to open the Dialog the terminal just says it crashed. If I had a warning first I would see it and second my application woudnt start at all</p>
]]></description><link>https://forum.qt.io/post/728932</link><guid isPermaLink="true">https://forum.qt.io/post/728932</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:08:26 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:03:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> I was trying to get every text for my QLineEdit; I wrote it like that just becuase I thought I have to wrote it like this to have the same result as the first answer i get.</p>
<blockquote>
<p dir="auto">What do you expect?</p>
</blockquote>
<p dir="auto">As I already said: I just want to get the texts from QLineEdit in my Dialog to my Main Window</p>
]]></description><link>https://forum.qt.io/post/728931</link><guid isPermaLink="true">https://forum.qt.io/post/728931</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:03:36 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 06:45:50 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728924">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">but crashed when I click the button to open the Dialog</p>
</blockquote>
<p dir="auto">I think it crashes here <code>QString value = pd.getResult();</code></p>
<p dir="auto">because your non void function has no return statement. You should have at least a warning about this in QtCreator.</p>
]]></description><link>https://forum.qt.io/post/728927</link><guid isPermaLink="true">https://forum.qt.io/post/728927</guid><dc:creator><![CDATA[J.Hilk]]></dc:creator><pubDate>Fri, 16 Sep 2022 06:45:50 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 06:44:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728924">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">I'm actually have more QLineEdit value to transfer from Dialog to MW</p>
</blockquote>
<p dir="auto">Either create a getter method for each of them or create a structure where you put all these strings and implement a getter method which returns this struct.</p>
]]></description><link>https://forum.qt.io/post/728926</link><guid isPermaLink="true">https://forum.qt.io/post/728926</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 16 Sep 2022 06:44:15 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 06:42:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728924">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">When I run the project It opens the MainWindow but crashed when I click the button to open the Dialog</p>
</blockquote>
<p dir="auto">What do you expect? I mean - what should this do:</p>
<pre><code>QString parametri::getValuePar()
{
    ui-&gt;pmFV-&gt;text();
    ui-&gt;glmF-&gt;text();
    ui-&gt;icpF-&gt;text();
    ui-&gt;gamEP-&gt;text();
}
</code></pre>
<p dir="auto">Please learn c++ basics.</p>
]]></description><link>https://forum.qt.io/post/728925</link><guid isPermaLink="true">https://forum.qt.io/post/728925</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Fri, 16 Sep 2022 06:42:03 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 07:10:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> It worked, thanks!<br />
Just a quick question: I'm actually have more QLineEdit value to transfer from Dialog to MW;<br />
I tried via getValuePar():</p>
<p dir="auto"><em>dialog.cpp</em></p>
<pre><code>QString parametri::getValuePar()
{
    QString pmFV =  ui-&gt;pmFV-&gt;text();    
   QString glmF = ui-&gt;glmF-&gt;text();    
     QString icpF =ui-&gt;icpF-&gt;text();    
     QString gamEP =ui-&gt;gamEP-&gt;text();    
      QString icpEP = ui-&gt;icpEP-&gt;text();
    return pmFV + glmF;
}

QString parametri::getResult()
{
    return getValuePar();
}
</code></pre>
<p dir="auto"><em>MainWindow,cpp</em></p>
<pre><code>void MainWindow::on_parametri_clicked()
{
    class parametri pd;
    pd.exec();
    QString value = pd.getResult();
    qDebug() &lt;&lt; value;
}
</code></pre>
<p dir="auto">When I run the project It opens the MainWindow but crashed when I click the button to open the Dialog</p>
]]></description><link>https://forum.qt.io/post/728924</link><guid isPermaLink="true">https://forum.qt.io/post/728924</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Fri, 16 Sep 2022 07:10:11 GMT</pubDate></item><item><title><![CDATA[Reply to From QLineEdit Dialog to MainWindows on Fri, 16 Sep 2022 06:15:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> said in <a href="/post/728917">From QLineEdit Dialog to MainWindows</a>:</p>
<blockquote>
<p dir="auto">How can I do it?</p>
</blockquote>
<p dir="auto">Add a getter method to your dialog which returns the data you need. No need for signals/slots here.</p>
<pre><code>// In MainWindow
Dialog dlg;
dlg.exec();
QString value = dlg.getResult();

// In Dialog
QString Dialog::getResult()
{
    return ui-&gt;pmFV-&gt;text();
}
</code></pre>
]]></description><link>https://forum.qt.io/post/728918</link><guid isPermaLink="true">https://forum.qt.io/post/728918</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 16 Sep 2022 06:15:41 GMT</pubDate></item></channel></rss>