Sorry about it, terrible mistake. I confused myself.
About the uninitialized variable, this is how the ICS video wrote the code:
ListDelegate delegate;
view.setItemDelegate(&delegate);
view.show();
ListDelegate delegate;
QListView view;
view.setItemDelegate(&delegate);
view.show();
To copy to clipboard, switch view to plain text mode
Which does not compile and outputs:
F
:\Documents\QT Projects\QListView_test
/main.
cpp:8: undefined reference to `ListDelegate
::ListDelegate(QObject*)':-1: error: collect2: ld returned 1 exit status
F:\Documents\QT Projects\QListView_test/main.cpp:8: undefined reference to `ListDelegate::ListDelegate(QObject*)'
:-1: error: collect2: ld returned 1 exit status
To copy to clipboard, switch view to plain text mode
And the ListDelegate class is written exactly as the video. But you are definitely right about my C++ skills...
Bookmarks