20 #include "mapAlgorithmProfileHelper.h"
26 QAbstractTableModel(parent)
33 SetAlgorithms(::map::deployment::DLLDirectoryBrowser::DLLInfoListType algList)
35 emit beginResetModel();
51 return m_AlgList.size();
66 data(
const QModelIndex &index,
int role)
const
73 if(index.row()<m_AlgList.size())
75 const ::map::deployment::DLLInfo*
info = m_AlgList[index.row()].GetPointer();
77 if(Qt::DisplayRole == role)
79 switch(index.column())
82 result = QVariant(info->getAlgorithmUID().getName().c_str());
85 result = QVariant(info->getAlgorithmUID().getNamespace().c_str());
88 result = QVariant(info->getAlgorithmUID().getVersion().c_str());
91 std::stringstream descriptionString;
92 ::map::algorithm::profile::ValueListType keys = ::map::algorithm::profile::getKeywords(info->getAlgorithmProfileStr());
93 for (::map::algorithm::profile::ValueListType::const_iterator keyPos = keys.begin(); keyPos!=keys.end();++keyPos)
95 if (keyPos != keys.begin())
97 descriptionString <<
"; ";
99 descriptionString << *keyPos;
101 descriptionString <<
"</p>";
102 result = QVariant(descriptionString.str().c_str());
106 else if (Qt::UserRole == role)
108 result = QVariant(index.row());
118 flags(
const QModelIndex &index)
const
120 Qt::ItemFlags
flags = QAbstractItemModel::flags(index);
127 headerData(
int section, Qt::Orientation orientation,
int role)
const
129 if( (Qt::DisplayRole == role) &&
130 (Qt::Horizontal == orientation))
134 return QVariant(
"Name");
138 return QVariant(
"Namespace");
142 return QVariant(
"Version");
146 return QVariant(
"Keywords");
QmitkAlgorithmListModel(QObject *parent=NULL)
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
static void info(const char *fmt,...)
virtual Qt::ItemFlags flags(const QModelIndex &index) const
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const
virtual QVariant data(const QModelIndex &index, int role) const
void SetAlgorithms(::map::deployment::DLLDirectoryBrowser::DLLInfoListType algList)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const