Do you really need custom delegate ? You could have used QListWidgetItem and QListWidgetItem::setCheckState .
Still hard to help you without seeing some code.
Do you really need custom delegate ? You could have used QListWidgetItem and QListWidgetItem::setCheckState .
Still hard to help you without seeing some code.
thanks for you reply.
i do need use custom delegate. my list view is like that.
QQ截圖20120621105615.png
the code works fine and have noting to do with the problem i asked. i want to improve the performance,so i encounter that problem.when i click the edit button, i change a bool value in the subclass of QAbstractItemDelegate,and in the function paint.
QQ截圖20120621110217.jpg
QQ截圖20120621110334.jpg
when i move my mouse ,the paint will be called and the checkbox will showed in the list.
but now i want to automatic repaint the listview ,not the movement of my mouse will activate it.so please help me, how to do that thing.
Did you try QListView::update or QListView::repaint when the Edit button is clicked ?
i found a special method to solve this problem. when i clicked the button,i call a function in delegate,which emit dataChanged signal.thus the paint function in model will be called and my checkbox will show in the frame.
i had tried QListIView::repaint, it no works. but QListView::update need a QModelIndex, and i do not know how to make one.so it is still stuck. and do you know how to send out the mouse movement event,if we know that,this problem will be solved.
Bookmarks