<?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[How to get complete row from qtable widget?]]></title><description><![CDATA[<p dir="auto">Im performing search operation on a tablewidget.(using search key)<br />
Highlighted found key in the table widget.<br />
Now i want to update the table, which contains only those rows which has search key.</p>
<p dir="auto">Now i already highlighted the found search key, but i'm unable to fetch whole row which contains the search key.<br />
Please tell me how can i get that particular row, which contain that search key?<br />
my code is as follows..<br />
@<br />
QString SearchKey=ui-&gt;lineEdit_key-&gt;text();<br />
QList&lt;QTableWidgetItem *&gt; LTempTable =temp-&gt;findItems(SearchKey,Qt::MatchExactly);</p>
<pre><code> cout&lt;&lt;"the matched count:"&lt;&lt;LTempTable.count()&lt;&lt;endl;
 foreach(rowPtr,LTempTable)
 {
    rowPtr-&gt;setBackground(Qt::red);
    int rowNo=temp-&gt;row(rowPtr);
    cout&lt;&lt;"THE ROW NUMBER IS:"&lt;&lt;rowNo&lt;&lt;endl;            &lt;-----getting row number but how can i get complete row?
 
    }
</code></pre>
<p dir="auto">}<br />
@</p>
]]></description><link>https://forum.qt.io/topic/12936/how-to-get-complete-row-from-qtable-widget</link><generator>RSS for Node</generator><lastBuildDate>Wed, 11 Nov 2026 12:16:44 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/12936.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 09 Jan 2012 11:17:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get complete row from qtable widget? on Tue, 10 Jan 2012 10:20:06 GMT]]></title><description><![CDATA[<p dir="auto">Ok thanks all..:)</p>
]]></description><link>https://forum.qt.io/post/123384</link><guid isPermaLink="true">https://forum.qt.io/post/123384</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Tue, 10 Jan 2012 10:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to How to get complete row from qtable widget? on Mon, 09 Jan 2012 14:13:09 GMT]]></title><description><![CDATA[<p dir="auto">You're missing a basic principle of the model-view architecture here. Instead of copying around rows, considder changing your setup to something like this:</p>
<h1>Replace your QTableWidget by a &lsqb;&lsqb;doc:QTableView&rsqb;&rsqb;</h1>
<h1>put your data in a model. That could be a &lsqb;&lsqb;doc:QStandardItemModel&rsqb;&rsqb; which has an API that is very similar to QTableWidget, but you could also use another type of model, perhaps something based on &lsqb;&lsqb;doc:QAbstractTableModel&rsqb;&rsqb;.</h1>
<h1>to highlight the rows, you insert a proxy model based on &lsqb;&lsqb;doc:QIdentityProxyModel&rsqb;&rsqb; between your model and the view</h1>
<h1>to display only the highlighted items in a <em>seconds</em> view, you create a new QTableView somewhere, and make that one display the <em>same</em> basic model, but this time filtered through a &lsqb;&lsqb;doc:QSortFilterProxyModel&rsqb;&rsqb;.</h1>
<p dir="auto">In this way, you have the source data only <em>once</em>, and you simply filter and display it in a different way.</p>
]]></description><link>https://forum.qt.io/post/123272</link><guid isPermaLink="true">https://forum.qt.io/post/123272</guid><dc:creator><![CDATA[andre]]></dc:creator><pubDate>Mon, 09 Jan 2012 14:13:09 GMT</pubDate></item><item><title><![CDATA[Reply to How to get complete row from qtable widget? on Mon, 09 Jan 2012 12:01:24 GMT]]></title><description><![CDATA[<p dir="auto">Well, you have rowNo and a pointer to your widget - temp (?). To copy all the items in the row, just do something like:<br />
@<br />
for (int c = 0; c &lt; temp-&gt;columnCount(); ++c)<br />
copyItem(temp-&gt;item(rowNo, c));<br />
@<br />
How you copy the individual items into the other table is up to you, I guess.</p>
]]></description><link>https://forum.qt.io/post/123244</link><guid isPermaLink="true">https://forum.qt.io/post/123244</guid><dc:creator><![CDATA[ludde]]></dc:creator><pubDate>Mon, 09 Jan 2012 12:01:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to get complete row from qtable widget? on Mon, 09 Jan 2012 11:39:34 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="ludde" date="1326108835"]By "complete row" you mean all the items in that row?<br />
In that case, can you not simply loop over the columns, and get the item in each column, with the given row number?<br />
Or did I misunderstand something?[/quote]</p>
<p dir="auto">Ya ludde exactly....<br />
I want all the items of that row and want to insert that row into some other table....<br />
How can i do that?</p>
]]></description><link>https://forum.qt.io/post/123239</link><guid isPermaLink="true">https://forum.qt.io/post/123239</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 09 Jan 2012 11:39:34 GMT</pubDate></item><item><title><![CDATA[Reply to How to get complete row from qtable widget? on Mon, 09 Jan 2012 11:33:55 GMT]]></title><description><![CDATA[<p dir="auto">By "complete row" you mean all the items in that row?<br />
In that case, can you not simply loop over the columns, and get the item in each column, with the given row number?<br />
Or did I misunderstand something?</p>
]]></description><link>https://forum.qt.io/post/123238</link><guid isPermaLink="true">https://forum.qt.io/post/123238</guid><dc:creator><![CDATA[ludde]]></dc:creator><pubDate>Mon, 09 Jan 2012 11:33:55 GMT</pubDate></item></channel></rss>