7 #ifndef __UIMEDDATAQT_WIDGET_SELECTORMODEL_HPP__ 8 #define __UIMEDDATAQT_WIDGET_SELECTORMODEL_HPP__ 10 #include "uiMedDataQt/config.hpp" 12 #include <fwMedData/Series.hpp> 13 #include <fwMedData/Study.hpp> 16 #include <QStandardItem> 17 #include <QStandardItemModel> 40 ITEM_TYPE = Qt::UserRole,
64 UIMEDDATAQT_API
void addSeries(::fwMedData::Series::sptr series);
70 UIMEDDATAQT_API
void removeSeries(::fwMedData::Series::sptr series);
73 UIMEDDATAQT_API
void clear();
76 Qt::ItemFlags
flags(
const QModelIndex& index)
const 78 return (QStandardItemModel::flags(index) & ~Qt::ItemIsEditable);
82 UIMEDDATAQT_API ItemType getItemType(
const QModelIndex& index);
89 UIMEDDATAQT_API QModelIndex getIndex(
const QModelIndex& index,
int column );
92 UIMEDDATAQT_API
void removeRows(
const QModelIndexList indexes);
95 UIMEDDATAQT_API QStandardItem* findSeriesItem(::fwMedData::Series::sptr series);
98 UIMEDDATAQT_API QStandardItem* findStudyItem(::fwMedData::Study::sptr study);
104 UIMEDDATAQT_API
void setSeriesIcons(
const SeriesIconType& seriesIcons);
107 UIMEDDATAQT_API
void setInsertMode(
bool insert);
111 typedef std::map< ::fwMedData::DicomValueType, QStandardItem* > StudyUidItemMapType;
117 template <
typename T>
118 QStandardItem* getInfo(T data, QString separator);
121 bool removeStudyItem(QStandardItem* item);
124 bool removeSeriesItem(QStandardItem* item);
127 void addSeriesIcon(::fwMedData::Series::sptr series, QStandardItem* item);
139 StudyUidItemMapType m_items;
145 SeriesIconType m_seriesIcons;
150 template <
typename T>
151 QStandardItem* SelectorModel::getInfo(T data, QString separator)
156 typename T::iterator itr = data.begin();
157 std::ostringstream str;
159 dataStr = QString::fromStdString(str.str());
161 for(; itr != data.end(); ++itr)
165 dataStr.append(separator + QString::fromStdString(str.str()));
168 QStandardItem* item =
new QStandardItem(dataStr);
175 #endif // __UIMEDDATAQT_WIDGET_SELECTORMODEL_HPP__ The namespace uiMedDataQt contains editors for medical data.