QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const { if (role != Qt::DisplayRole || !index.isValid () || !_effect || index.column () >= 2) { return QVariant (); } unsigned num = _effect->GetNumberOfPrograms (_stage); if (index.row () >= num) { return QVariant (); } if (index.column () == 0) { return QVariant (_effect->GetProgramName (_stage, index.row ())); } else if (index.column () == 1) { Program* prog = _effect->GetProgram (_stage, _effect->GetProgramName (_stage, index.row ())); if (prog) { return QVariant (prog->GetCategory().GetFullName()+"."+prog->GetFullname()); } return QVariant ("<undefined>"); } return QVariant (); }
QModelIndex index (int row, int column, const QModelIndex &parent = QModelIndex()) const { if (parent.isValid () || column >= 2 || !_effect || row >= _effect->GetNumberOfPrograms (_stage)) { return QModelIndex (); } return createIndex (row, column); }
int rowCount (const QModelIndex &parent = QModelIndex()) const { if (parent.isValid () || !_effect) return 0; return _effect->GetNumberOfPrograms(_stage); }