Is there any way to disable QListWidgetItem in my QListWidget?
<p>I am using <code>QListWidgetItem</code> to add Items in my <code>QListWidget</code>. </p>

<p>In some situations, I want some rows of my <code>QListWidget</code> become <strong>non selectable</strong>. (I mean I want some <code>QListWidgetItem</code> to be <strong>non selectable</strong>)</p>

<p>Is ther any way to do this?</p>

<p>PS: I tried </p>

<pre><code>listWidgetItem-&gt;setFlags(Qt::NoItemFlags)

listWidgetItem-&gt;setSelected(false);
</code></pre>

<p>but they don't disable the selection of items.</p>

<p>Edit:</p>

<pre><code>QStringList _strListClients = _strClients.split(",",QString::KeepEmptyParts,Qt::CaseInsensitive);

for(int i = 0; i &lt; _strListClients.count(); i++)//Add Client's Check Boxes
{
    QListWidgetItem* _listWidgetItem = new QListWidgetItem(_strListClients[i], listWidgetClients);
    listWidgetClients-&gt;addItem(_listWidgetItem);

    if(_strListClients[i] == "Unknown"){
        _listWidgetItem-&gt;setSelected(false);
        _listWidgetItem-&gt;setTextColor(Qt::red);
        _listWidgetItem-&gt;setFlags(_listWidgetItem-&gt;flags() &amp; ~Qt::ItemIsSelectable);

    }
</code></pre>

<p>}</p>