<?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[Disable the combo box specific item]]></title><description><![CDATA[<p dir="auto">Is there a way to disable a specific item in the combo box?</p>
<p dir="auto">For example, there is a combo box containing items from 1 to 5. I want to limit the items that can be selected according to the permission</p>
]]></description><link>https://forum.qt.io/topic/132433/disable-the-combo-box-specific-item</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 20:37:09 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/132433.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 Dec 2021 08:17:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Disable the combo box specific item on Wed, 01 Dec 2021 08:25:57 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">What comes to mind:</p>
<ul>
<li>Use a <a href="https://doc.qt.io/qt-5/qsortfilterproxymodel.html" target="_blank" rel="noopener noreferrer nofollow ugc">QSortFilterProxyModel</a> on top of a <a href="https://doc.qt.io/qt-5/qstringlistmodel.html" target="_blank" rel="noopener noreferrer nofollow ugc">QStringListModel</a> and filter out the values the person cannot select</li>
<li>Use a custom model where you re-implement the <a href="https://doc.qt.io/qt-5/qabstractitemmodel.html#flags" target="_blank" rel="noopener noreferrer nofollow ugc">flags</a></li>
</ul>
<p dir="auto">The first avoids to show "invalid values" to your user (asking why can't I select them ?).<br />
The second should do what you original want at the risk of your users wondering why there are unelectable items in a control which should offer them only valid choices.</p>
]]></description><link>https://forum.qt.io/post/692622</link><guid isPermaLink="true">https://forum.qt.io/post/692622</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Wed, 01 Dec 2021 08:25:57 GMT</pubDate></item></channel></rss>