No, i have not set mouse tracking, and I can't receive the mouse Move event in MyListView when no button is pressed.
these code in MyListView constructor:
FileClipModel *model = new FileClipModel;
FileClipDelegate *delegate = new FileClipDelegate;
setModel(model);
setItemDelegate(delegate);
FileClipModel *model = new FileClipModel;
FileClipDelegate *delegate = new FileClipDelegate;
setModel(model);
setItemDelegate(delegate);
To copy to clipboard, switch view to plain text mode
this is delegate paint. It is called when mouse enter in/out whitout button pressed. Every time the mouse enter in/out MyListView , all item color changed!
{
painter
->fillRect
(option.
rect,
QColor(double(qrand
())/RAND_MAX*255,
double(qrand
())/RAND_MAX*255,
double(qrand
())/RAND_MAX*255));
}
void FileClipDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)const
{
painter->fillRect(option.rect,QColor(double(qrand())/RAND_MAX*255,double(qrand())/RAND_MAX*255,double(qrand())/RAND_MAX*255));
}
To copy to clipboard, switch view to plain text mode
Bookmarks