PDA

View Full Version : QListWidget non-selected to start



bmahf
20th January 2011, 14:03
I've looked on the net and in this forum and haven't yet found someone talking about this issue. I'm trying to display a list of possible items to select in a dialog, and I'm using a QListWidget to do it. The problem is that I don't want any of the items to be selected when the list is first displayed. The widget selects the first item by default. I'd like to know how to turn that display off, so that all items are equally unselected, and the user doesn't get "pointed" toward a "preferred" choice. Does anyone have a suggestion?

majorwoody
20th January 2011, 14:34
Did you already try QAbstractItemView::clearSelection ()?

bmahf
21st January 2011, 16:32
Yes, I did that, but strangely enough, the first item in the list is still showing with a different aspect than the rest. From reading the description for that method, it would seem that it should have "Deselect[ed] all selected items". Maybe it did that logically, but not visually. It does say that the current index will not be changed. Is there a tie to the fact that the index is still set? I tried setCurrentItem(0,QItemSelectionModel::Deselect), but that didn't work neither. I'm not sure why this doesn't work.

majorwoody
21st January 2011, 19:17
Now I know, what you mean. You want the dotted rectangle disappear. That's the mark of the current row. The item is not actually selected(inverted line). I see the problem, that people could be manipulated to select the dotted Item, but I have no clue to solve that problem.

bmahf
24th January 2011, 12:49
Anyone? I'm really kind of stumped here.