7 #include "uiMedDataQt/widget/Selector.hpp" 9 #include <fwData/Image.hpp> 11 #include <fwMedData/Equipment.hpp> 12 #include <fwMedData/ImageSeries.hpp> 13 #include <fwMedData/Patient.hpp> 14 #include <fwMedData/Series.hpp> 15 #include <fwMedData/Study.hpp> 17 #include <QItemSelectionModel> 19 #include <QModelIndexList> 20 #include <QStandardItem> 35 this->setModel(m_model);
37 this->setSelectionMode(QAbstractItemView::ExtendedSelection);
38 this->setAlternatingRowColors(
true );
39 this->setDragEnabled(
true);
59 m_model->setInsertMode(insert);
66 m_model->addSeries(series);
67 QStandardItem* studyItem = m_model->findStudyItem(series->getStudy());
68 this->expand(m_model->indexFromItem(studyItem));
70 for (
int i = 0; i < m_model->columnCount(); ++i)
72 this->resizeColumnToContents(i);
80 m_model->removeSeries(series);
87 m_allowedRemove = allowed;
94 QTreeView::selectionChanged(selected, deselected);
96 SeriesVectorType selectedSeries = this->
getSeries(selected);
98 SeriesVectorType deselectedSeries = this->
getSeries(deselected);
107 SeriesVectorType vSeries;
109 QModelIndexList selectedIndexes = selection.indexes();
110 vSeries = this->
getSeries(selectedIndexes);
118 SeriesVectorType vSeries;
119 for(QModelIndex index : indexList)
126 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast(obj);
127 vSeries.push_back(series);
137 QModelIndexList studiesIndex;
138 for(QModelIndex index : indexList)
142 studiesIndex.push_back(index);
152 SeriesVectorType vSeries;
153 QStandardItem* item = m_model->itemFromIndex(index);
154 int nbRow = item->rowCount();
155 for(
int row = 0; row < nbRow; ++row)
157 QStandardItem* child = item->child(row);
159 SLM_ASSERT(
"UID must not be empty.", !uid.empty());
161 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast(obj);
162 vSeries.push_back(series);
171 return m_model->getItemType(index);
178 if(event->matches(QKeySequence::Delete) && m_allowedRemove)
185 QTreeView::keyPressEvent(event);
193 QModelIndexList selection = this->selectionModel()->selectedRows(0);
195 SeriesVectorType vSeries = this->
getSeries(selection);
197 for(QModelIndex index : studyIndexes)
200 std::copy(series.begin(), series.end(), std::back_inserter(vSeries));
206 m_model->removeRows(selection);
213 m_model->setSeriesIcons(seriesIcons);
The namespace uiMedDataQt contains editors for medical data.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...