Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QVariant PiecesModel::data ( const QModelIndex index,
int  role = Qt::DisplayRole 
) const [virtual]

Returns the data stored under the given role for the item referred to by the index.

If you do not have a value to return, return an invalid QVariant() instead of returning 0.
See also:
Qt::ItemDataRole, setData(), headerData()

Implements QAbstractItemModel.

Definition at line 51 of file piecesmodel.cpp.

References QModelIndex::isValid(), QModelIndex::row(), and QList< T >::value().

Referenced by mimeData().

    if (!index.isValid())
        return QVariant();

    if (role == Qt::DecorationRole)
        return QIcon(pixmaps.value(index.row()).scaled(60, 60,
                         Qt::KeepAspectRatio, Qt::SmoothTransformation));
    else if (role == Qt::UserRole)
        return pixmaps.value(index.row());
    else if (role == Qt::UserRole + 1)
        return locations.value(index.row());

    return QVariant();

Here is the call graph for this function:

Here is the caller graph for this function:

Generated by  Doxygen 1.6.0   Back to index