<?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[QSortFilterProxyModel: Proper use of beginFilterChange()&#x2F;endFilterChange()?]]></title><description><![CDATA[<p dir="auto">When header data changes in my source model, I want my <code>QSortFilterProxyModel</code>  to invalidate its columns filter.</p>
<p dir="auto">I used to do this with:</p>
<pre><code>self.sourceModel().headerChanged.connect(self.invalidateColumnsFilter)
</code></pre>
<p dir="auto">However, the docs have <a href="https://doc.qt.io/qtforpython-6/PySide6/QtCore/QSortFilterProxyModel.html#PySide6.QtCore.QSortFilterProxyModel.invalidateColumnsFilter" target="_blank" rel="noopener noreferrer nofollow ugc">now listed  <code>invalidateColumnsFilter</code> as deprecated</a> and suggest to use <code>beginFilterChange()</code> and <code>endFilterChange(Direction)</code> instead.  That's cool, but I feel a little weird about it since <code>QAbstractItemModel</code> doesn't have "dataAboutToChange" or "headerDataAboutToChange"-style signals to link up the beginFilter/endFilter stuff; it just has dataChanged / headerDataChanged.</p>
<p dir="auto">So am I okay to connect headerDataChanged() to a method in my proxy model that <em>then</em> calls <em>both</em> the begin/endFilterChange() methods?  This feels out-of-order.</p>
<pre><code>self.sourceModel().headerDataChanged.connect(self.binColumnDataChanged)

@QtCore.Slot(QtCore.Qt.Orientation, int, int)
def binColumnDataChanged(self, orientation:QtCore.Qt.Orientation, first:int, last:int):
	self.beginFilterChange()
	self.endFilterChange(QtCore.QSortFilterProxyModel.Direction.Columns)
</code></pre>
]]></description><link>https://forum.qt.io/topic/164297/qsortfilterproxymodel-proper-use-of-beginfilterchange-endfilterchange</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Apr 2026 23:29:22 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164297.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 20 Feb 2026 18:50:20 GMT</pubDate><ttl>60</ttl></channel></rss>