Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to clear the selection of QListView when multiple items are selected?
    text
    copied!<p>I am working on a Qt App where I have a QListView. There are few items present in the list. My application requires items to be rearranged according to user's choice. Everything is working fine but I am facing a small issue.</p> <p>When I do multiple selection using a mouse i.e. select items by dragging the mouse, it leaves the selection mark on the QlistView even after I do some rearranging operation. I am sure its got something to do with clearing the selection. I tried to use repaint() or clearFocus() but nothing seems to be working. </p> <p>E.g When we select a group of folders we drag our mouse, which intern gives us rectangular box which covers all the items which come under it. That particular rectangle box stays inside my QListView. I do not want it after I have selected the items.</p> <p>I have a mousemoveevent inside which I am doing it:</p> <pre><code> void BinListView::mouseMoveEvent (QMouseEvent *event) { if (NULL == event) { return; } else { if (Qt::LeftButton &amp; event-&gt;buttons ()) { int nDis = (event-&gt;pos () - m_posStart).manhattanLength (); if (nDis &gt;= QApplication::startDragDistance ()) { startDrag (m_posStart); } } #ifdef QT_NO_DEBUG QListView::mouseMoveEvent (event); QListView::repaint(); QListView::clearFocus(); #endif } repaint(); } </code></pre> <p>If you notice QT_NO_DEBUG area, you will see my clearing focus and repainting but nothing is helping me. ANy solution to this problem?</p> <p>P.S.: I am running it in a release mode.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload