# HG changeset patch # User John Kern # Date 1284134420 25200 # Node ID 863c77d1582827f78628c01ac27da7677514e213 # Parent c6e75ec74fc8170bf7a43813a16b0b459d368e3d added some comments diff -r c6e75ec74fc8 -r 863c77d15828 ListElements/ModelViewList/zodiacmodel.cpp --- a/ListElements/ModelViewList/zodiacmodel.cpp Thu Sep 09 20:03:34 2010 -0700 +++ b/ListElements/ModelViewList/zodiacmodel.cpp Fri Sep 10 09:00:20 2010 -0700 @@ -80,9 +80,17 @@ int ZodiacModel::rowCount (const QModelIndex &index) const { + Q_UNUSED(index) return this->signs.count(); } + +// This is a virtual method for the QAbstractItemList. +// Currently, this code uses a delegate which draws the list item. So, the data() method is +// effectively ignored by the QListView in favor of the delegate class. +// If you chose not to use the delegate, the QListView will query this method. Remember +// to change the type returned by Qt::DecorationRole to ICon. + QVariant ZodiacModel::data(const QModelIndex &index, int role)const { QVariant rc; @@ -118,7 +126,10 @@ } case Qt::DecorationRole: { + // For the delegate we return a QString rc = QVariant(this->signs.at(index.row())->getImage()); + // if you are not using a delegate, return a QIcon like this. + // rc = QVariant(QIcon(this->signs.at(index.row())->getImage())); } default: break;