<?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[getText QLineEdit in tableWidget]]></title><description><![CDATA[<p dir="auto">Hi!<br />
I've been created a table with tableWidget and I also insert QLineEdit in every cell.<br />
But now I need to retrive the text written in the QLineEdits.<br />
Like if someone write in the second cell of the first row, how can I retrive the value of that QLineEdit?</p>
<p dir="auto">This is how my table is implemanted (with 2columns added via <em>parametri.ui</em>):</p>
<pre><code>Parametri::Parametri(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Parametri)
{
    ui-&gt;setupUi(this);
    setWindowTitle("Parametri");

    for(int row=0;row&lt;=21;row++){    
           val = new QLineEdit(this);        
           ui-&gt;tableWidget-&gt;setCellWidget(row,0,val);    
           val-&gt;setAlignment(Qt::AlignCenter);    
           val-&gt;setText("8.00");
        }
}
</code></pre>
<p dir="auto">Thanks for anyone who can help me</p>
]]></description><link>https://forum.qt.io/topic/139256/gettext-qlineedit-in-tablewidget</link><generator>RSS for Node</generator><lastBuildDate>Thu, 05 Nov 2026 16:24:38 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/139256.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 12 Sep 2022 14:12:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Tue, 13 Sep 2022 09:13:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a> thanks it workedd!</p>
]]></description><link>https://forum.qt.io/post/728514</link><guid isPermaLink="true">https://forum.qt.io/post/728514</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Tue, 13 Sep 2022 09:13:22 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 15:37:26 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a><br />
Well if you only want to know about one cell specify its row, column <code>cellWidget(row, column)</code> instead of going through some loop!</p>
<pre><code>QTextEdit *textEdit = qobject_cast&lt;QTextWidget *&gt;(ui-&gt;tableWidget-&gt;cellWidget(row, column));
if (textEdit)
    qDebug() &lt;&lt; textEdit-&gt;text();
</code></pre>
]]></description><link>https://forum.qt.io/post/728413</link><guid isPermaLink="true">https://forum.qt.io/post/728413</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 12 Sep 2022 15:37:26 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 15:31:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jonb">@<bdi>JonB</bdi></a></p>
<blockquote>
<p dir="auto">Is this not what you want/what do you want?</p>
</blockquote>
<p dir="auto">No, I would like to have for a single cell</p>
<blockquote>
<p dir="auto">If this is what you mean, then only look at "the second cell of the first row", not every cell?</p>
</blockquote>
<p dir="auto">That's what I'm not understanding how to do it and asking<br />
How do I focus just one cell and print the text, not the Widget?</p>
]]></description><link>https://forum.qt.io/post/728412</link><guid isPermaLink="true">https://forum.qt.io/post/728412</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Mon, 12 Sep 2022 15:31:44 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 15:17:21 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/728407">getText QLineEdit in tableWidget</a>:</p>
<blockquote>
<p dir="auto">But as expected, it shows every text of every QLineEdit.</p>
</blockquote>
<p dir="auto">Is this not what you want/what do you want?</p>
<blockquote>
<p dir="auto">Like if someone write in the second cell of the first row, how can I retrive the value of that QLineEdit?</p>
</blockquote>
<p dir="auto">If this is what you mean, then only look at "the second cell of the first row", not <em>every</em> cell?</p>
]]></description><link>https://forum.qt.io/post/728408</link><guid isPermaLink="true">https://forum.qt.io/post/728408</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Mon, 12 Sep 2022 15:17:21 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 15:05:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Yeah, I edited because I was catching some try I did in the mainWindow.<br />
I tried with the second link u sent me but having trouble (thanks to my being noob).<br />
now i was trying with this  <code>qDebug() &lt;&lt; val-&gt;displayText();</code><br />
But as expected, it shows every text of every QLineEdit.</p>
<blockquote>
<p dir="auto">Of course you will need to cast the pointer returned by cellWidget to QLineEdit*</p>
</blockquote>
<p dir="auto">That I have to look how to do it</p>
<p dir="auto">Thks 4 your help</p>
]]></description><link>https://forum.qt.io/post/728407</link><guid isPermaLink="true">https://forum.qt.io/post/728407</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Mon, 12 Sep 2022 15:05:59 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 14:55: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/728404">getText QLineEdit in tableWidget</a>:</p>
<blockquote>
<p dir="auto">But I'm not understanding how to show the text inside the QLineEdit.</p>
</blockquote>
<p dir="auto">That was the second link I gave you: <a href="https://doc.qt.io/qt-6/qlineedit.html#text-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qlineedit.html#text-prop</a><br />
Of course you will need to cast the pointer returned by cellWidget to QLineEdit*.</p>
<p dir="auto">QWidget(0x0) - looks like there is no widget set in 1,2? And if I look at your loop you only have one column, not 3...</p>
]]></description><link>https://forum.qt.io/post/728405</link><guid isPermaLink="true">https://forum.qt.io/post/728405</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:55:51 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 15:01:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a>  I've tried with the CellWidget, like this:</p>
<pre><code> qDebug() &lt;&lt; ui-&gt;tableWidget-&gt;cellWidget(3,0);
</code></pre>
<p dir="auto">Just to see the first output. And this is what it's showing in the terminal <code>QLineEdit(0x58e6f30)</code></p>
<p dir="auto">But I'm not understanding how to show the text inside the QLineEdit.</p>
]]></description><link>https://forum.qt.io/post/728404</link><guid isPermaLink="true">https://forum.qt.io/post/728404</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Mon, 12 Sep 2022 15:01:43 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 14:26:43 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/728397">getText QLineEdit in tableWidget</a>:</p>
<blockquote>
<p dir="auto">sorry if I dont know every function</p>
</blockquote>
<p dir="auto">It is fine to not to know every function, but you can easilly find these two functions in the documentation.<br />
Usually, if there is a setSomething() method there is also a something() method.</p>
]]></description><link>https://forum.qt.io/post/728402</link><guid isPermaLink="true">https://forum.qt.io/post/728402</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:26:43 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 14:23:02 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a> Nothing is wrong with them.<br />
I just start learning QT, sorry if I dont know every function.<br />
Thnks.</p>
]]></description><link>https://forum.qt.io/post/728397</link><guid isPermaLink="true">https://forum.qt.io/post/728397</guid><dc:creator><![CDATA[aim0d]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:23:02 GMT</pubDate></item><item><title><![CDATA[Reply to getText QLineEdit in tableWidget on Mon, 12 Sep 2022 14:21:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aim0d">@<bdi>aim0d</bdi></a> What is wrong with <a href="https://doc.qt.io/qt-6/qtablewidget.html#cellWidget" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qtablewidget.html#cellWidget</a> and <a href="https://doc.qt.io/qt-6/qlineedit.html#text-prop" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qlineedit.html#text-prop</a> ?</p>
]]></description><link>https://forum.qt.io/post/728395</link><guid isPermaLink="true">https://forum.qt.io/post/728395</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Mon, 12 Sep 2022 14:21:21 GMT</pubDate></item></channel></rss>