<?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 register adding row event to QTableWidget]]></title><description><![CDATA[<p dir="auto">Hi guys,</p>
<p dir="auto">I have multiple QTableWidget in my desktop application,<br />
Currently, i assign them to use same custom context menu for adding, clone, remove row(s).<br />
But i stuck in case: each table have different condition check when add new row.</p>
<p dir="auto">For example: Column 1 in table A is text format, column 1 in table B is checkbox format (im using setCellWidget to assign checkbox), column 1 in table C is combobox format =&gt; So if in add new row menu action, just use table-&gt;insertRow(table-&gt;rowCount()) is not enough, all cell in new row have default text field.</p>
<p dir="auto">So, i wonder is there anyway to register adding row event on QTableWidget to create different cell format for each table?</p>
]]></description><link>https://forum.qt.io/topic/141905/how-to-register-adding-row-event-to-qtablewidget</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Nov 2026 03:33:18 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/141905.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Jan 2023 08:25:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to register adding row event to QTableWidget on Tue, 03 Jan 2023 10:25:36 GMT]]></title><description><![CDATA[<p dir="auto">My current workaround is set table not editable,</p>
<p dir="auto">Then, implement cell double click slot.</p>
<p dir="auto">In cell double click slot, detect which cell is clicking at, set correspond cell widget and then programmatically edit that cell like below</p>
<pre><code>QModelIndex index = this-&gt;ui-&gt;tableA-&gt;model()-&gt;index(row, column);
this-&gt;ui-&gt;tableA-&gt;setCurrentIndex(index);
this-&gt;ui-&gt;tableA-&gt;edit(index);
</code></pre>
]]></description><link>https://forum.qt.io/post/742292</link><guid isPermaLink="true">https://forum.qt.io/post/742292</guid><dc:creator><![CDATA[Sabrac]]></dc:creator><pubDate>Tue, 03 Jan 2023 10:25:36 GMT</pubDate></item></channel></rss>