<?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[Detecting checkbox toggle via keyboard on a QTreeWidgetItem]]></title><description><![CDATA[<p dir="auto">In my QTreeWidget, each of its QTreeWidgetItems has a checkbox which is set up by calling <code>checklistItem.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable)</code>, where <code>checklistItem</code> is a QTreeWidgetItem.</p>
<p dir="auto">I can detect whether the user is checking or unchecking the checkbox via mouse click by connecting the <code>itemClicked</code> signal on the QTreeWidget. But how would I do the same if the user toggled the checkbox state by pressing the spacebar on their keyboard? I tried connecting the <code>itemActivated</code> signal, but it doesn't have any effect. The UI I'm building requires that I check for the checkbox state change as soon as it happens, so going through all the checkboxes in the dialog's <code>accept()</code> event handler method is not a viable solution.</p>
<p dir="auto">Using Qt for Python 6.11 on macOS 26 Tahoe.</p>
]]></description><link>https://forum.qt.io/topic/165051/detecting-checkbox-toggle-via-keyboard-on-a-qtreewidgetitem</link><generator>RSS for Node</generator><lastBuildDate>Sat, 26 Sep 2026 18:18:18 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/165051.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 02 Sep 2026 17:33:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Detecting checkbox toggle via keyboard on a QTreeWidgetItem on Wed, 02 Sep 2026 17:37:16 GMT]]></title><description><![CDATA[<p dir="auto">You should get a <a href="https://doc.qt.io/qt-6/qtreewidget.html#itemChanged" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-6/qtreewidget.html#itemChanged</a> signal when the data of an item changes.</p>
]]></description><link>https://forum.qt.io/post/839943</link><guid isPermaLink="true">https://forum.qt.io/post/839943</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Wed, 02 Sep 2026 17:37:16 GMT</pubDate></item></channel></rss>