<?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[Highlight table column]]></title><description><![CDATA[<p dir="auto">Hello , i have a QStandardItemModel table and i'd like to highlight one of the column after the occurrence of an event.</p>
<p dir="auto">To be more clear i have this situation at start<br />
<img src="https://s15.postimg.org/p3k57m7t7/Table1.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">in this other picture is shown what i'm trying to reach. this is what is happening when i'm clicking the header of the table definited by HorizontalHeaderLabel "4". So basically I'm trying to figure out how to simulate the click on the header defined by headerlabel "4"<br />
<img src="https://s18.postimg.org/rrj758ex5/Table2.png" alt="alt text" class=" img-fluid img-markdown" /></p>
<p dir="auto">And this is the way i get the column values</p>
<pre><code>void measure::on_tableViewTop_clicked(const QModelIndex &amp;index)
{
     ui-&gt;tableViewTop-&gt;setCurrentIndex (index);
     int r = index.row();
     int c = index.column ();
     qDebug() &lt;&lt; "Row: " &lt;&lt; r;
     qDebug() &lt;&lt; "Column: " &lt;&lt; c;
     qDebug() &lt;&lt; "X: " &lt;&lt;   ui-&gt;tableViewTop-&gt;model()-&gt;data(ui-&gt;tableViewTop-&gt;model()-&gt;index(0,c)).toString();
     qDebug() &lt;&lt; "Y: " &lt;&lt;   ui-&gt;tableViewTop-&gt;model()-&gt;data(ui-&gt;tableViewTop-&gt;model()-&gt;index(1,c)).toString(); 
     qDebug() &lt;&lt; "Z: " &lt;&lt;   ui-&gt;tableViewTop-&gt;model()-&gt;data(ui-&gt;tableViewTop-&gt;model()-&gt;index(2,c)).toString();
}
</code></pre>
<p dir="auto">Hope you can help ;) And forive me for my not so clear english :P</p>
]]></description><link>https://forum.qt.io/topic/74140/highlight-table-column</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 20:18:05 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/74140.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 09 Dec 2016 09:46:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Highlight table column on Fri, 09 Dec 2016 14:03:50 GMT]]></title><description><![CDATA[<p dir="auto">@Wieland said in <a href="/post/363743">Highlight table column</a>:</p>
<blockquote>
<p dir="auto">Hi! Please refrain from <a href="http://whirlpool.net.au/wiki/wp_threadbumping" target="_blank" rel="noopener noreferrer nofollow ugc">thread bumping</a>.</p>
<p dir="auto">Selecting items is done in the view, not in the model. <code>void QTableView::selectColumn(int column) [slot]</code>, see: <a href="http://doc.qt.io/qt-5/qtableview.html#selectColumn" target="_blank" rel="noopener noreferrer nofollow ugc">QTableView Class</a>.</p>
</blockquote>
<p dir="auto">Sorry didn't want to spam or do thread bumbing. It's the first time i'm having this behaviour after many posts</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/vronin">@<bdi>VRonin</bdi></a> said in <a href="/post/363744">Highlight table column</a>:</p>
<blockquote>
<p dir="auto">What's your view <code>selectionMode</code> and <code>selectionBehaviour</code>? do you reimplement a selectEvent?</p>
</blockquote>
<p dir="auto">The selection mode is "ExtendedSelection" while the selectionBehaviour is "SelectItems"<br />
Changing it to selectColumns seems to do what i wanted to do...</p>
<p dir="auto">Thanks for pointing me to the right direction ;)</p>
]]></description><link>https://forum.qt.io/post/363747</link><guid isPermaLink="true">https://forum.qt.io/post/363747</guid><dc:creator><![CDATA[Bruschetta]]></dc:creator><pubDate>Fri, 09 Dec 2016 14:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Highlight table column on Fri, 09 Dec 2016 13:45:42 GMT]]></title><description><![CDATA[<p dir="auto">What's your view <code>selectionMode</code> and <code>selectionBehaviour</code>? do you reimplement a selectEvent?</p>
]]></description><link>https://forum.qt.io/post/363744</link><guid isPermaLink="true">https://forum.qt.io/post/363744</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Fri, 09 Dec 2016 13:45:42 GMT</pubDate></item><item><title><![CDATA[Reply to Highlight table column on Fri, 09 Dec 2016 13:43:48 GMT]]></title><description><![CDATA[<p dir="auto">Hi! Please refrain from <a href="http://whirlpool.net.au/wiki/wp_threadbumping" target="_blank" rel="noopener noreferrer nofollow ugc">thread bumping</a>.</p>
<p dir="auto">Selecting items is done in the view, not in the model. <code>void QTableView::selectColumn(int column) [slot]</code>, see: <a href="http://doc.qt.io/qt-5/qtableview.html#selectColumn" target="_blank" rel="noopener noreferrer nofollow ugc">QTableView Class</a>.</p>
]]></description><link>https://forum.qt.io/post/363743</link><guid isPermaLink="true">https://forum.qt.io/post/363743</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Fri, 09 Dec 2016 13:43:48 GMT</pubDate></item><item><title><![CDATA[Reply to Highlight table column on Fri, 09 Dec 2016 13:33:11 GMT]]></title><description><![CDATA[<p dir="auto">Noone knows how to do it? :(</p>
]]></description><link>https://forum.qt.io/post/363742</link><guid isPermaLink="true">https://forum.qt.io/post/363742</guid><dc:creator><![CDATA[Bruschetta]]></dc:creator><pubDate>Fri, 09 Dec 2016 13:33:11 GMT</pubDate></item></channel></rss>