You didn't implement the constructor for the ListDelegate class.
How do I implement it? I thought that ListDelegate(QObject *parent=0);was the constructor for the ListDelegate class.
Don't kill me for asking, but how do I implement it? The video didn't write anything else, the source code, QAbstractItemDelegate.cpp the body of the constructor is blank , it's just like that:
Qt Code:
{ }To copy to clipboard, switch view to plain text mode
And now when I try to compile I get this other error:
Qt Code:
F:/Documents/QT Projects/QListView_test/main.cpp:10: error: no matching function for call to 'QListView::setItemDelegate(ListDelegate&)' c:\Qt\2009.05\qt\include\QtGui/../../src/gui/itemviews/qabstractitemview.h:135: note: candidates are: void QAbstractItemView::setItemDelegate(QAbstractItemDelegate*)To copy to clipboard, switch view to plain text mode
Im trying to understand, doing my best. Thanks for your help.![]()
For some unknown reason it compiled and now runs perfectly. With main :
Qt Code:
ListDelegate delegate; QListView view; view.setItemDelegate(&delegate); view.show();To copy to clipboard, switch view to plain text mode
And ListDelegate constructor:
Qt Code:
{ }To copy to clipboard, switch view to plain text mode
I still am clueless as to why. I read the pixelator example on QT, and it's custom delegate class constructor is the same as mine, empty.
Now if I try to use a custom QAbstractListModel I get the same issues as I previously had with QAbstractItemDelegate.
Ok. Thanks for your help.![]()
Bookmarks