61 return m_BaseRenderer.
Lock();
66 bool hasIndex = this->hasIndex(row, column, parent);
69 return this->createIndex(row, column);
82 Qt::ItemFlags
flags = Qt::NoItemFlags;
83 if (index.isValid() && index.model() ==
this)
85 flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
86 if (0 == index.column())
88 flags |= Qt::ItemIsUserCheckable;
97 if (Qt::Horizontal == orientation && Qt::DisplayRole == role)
101 return QVariant(
"Visibility");
103 else if (1 == section)
105 return QVariant(
"Data node");
113 if (parent.isValid())
118 return static_cast<int>(m_TempLayerStack.size());
123 if (parent.isValid())
133 if (!index.isValid() || index.model() !=
this)
138 if ((index.row()) < 0 || index.row() >=
static_cast<int>(m_TempLayerStack.size()))
143 RenderWindowLayerUtilities::LayerStack::const_iterator layerStackIt = m_TempLayerStack.begin();
144 std::advance(layerStackIt, index.row());
146 if (Qt::CheckStateRole == role && 0 == index.column())
148 bool visibility =
false;
156 return Qt::Unchecked;
159 else if (Qt::DisplayRole == role && 1 == index.column())
161 return QVariant(QString::fromStdString(dataNode->GetName()));
163 else if (Qt::ToolTipRole == role)
165 if (0 == index.column())
167 return QVariant(
"Show/hide data node.");
169 else if (1 == index.column())
171 return QVariant(
"Name of the data node.");
180 return QVariant::fromValue<mitk::DataNode*>(dataNode);
188 if (!index.isValid() || index.model() !=
this)
193 if ((index.row()) < 0 || index.row() >=
static_cast<int>(m_TempLayerStack.size()))
200 auto baseRenderer = m_BaseRenderer.
Lock();
202 RenderWindowLayerUtilities::LayerStack::const_iterator layerStackIt = m_TempLayerStack.begin();
203 std::advance(layerStackIt, index.row());
205 if (Qt::CheckStateRole == role)
207 Qt::CheckState newCheckState =
static_cast<Qt::CheckState
>(value.toInt());
209 if (Qt::PartiallyChecked == newCheckState || Qt::Checked == newCheckState)
215 dataNode->SetVisibility(
false, baseRenderer);
217 emit dataChanged(index, index);
226 void QmitkDataStorageLayerStackModel::UpdateModelData()
void SetCurrentRenderer(const std::string &rendererName)
QModelIndex index(int row, int column, const QModelIndex &parent) const
overridden functions from QAbstractItemModel
itk::SmartPointer< T > Lock() const
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer=nullptr, const char *propertyKey="visible")
Convenience method for setting visibility properties (instances of BoolProperty)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void NodePredicateChanged() override
mitk::BaseRenderer * GetCurrentRenderer() const
void NodeRemoved(const mitk::DataNode *node) override
Organizes the rendering process.
QModelIndex parent(const QModelIndex &child) const
void NodeChanged(const mitk::DataNode *node) override
QVariant data(const QModelIndex &index, int role) const override
QmitkDataStorageLayerStackModel(QObject *parent=nullptr)
itk::SmartPointer< Self > Pointer
Qt::ItemFlags flags(const QModelIndex &index) const override
static RenderingManager * GetInstance()
bool IsExpired() const noexcept
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey="visible") const
Convenience access method for visibility properties (instances of BoolProperty with property-key "vis...
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
MITKRENDERWINDOWMANAGER_EXPORT LayerStack GetLayerStack(const DataStorage *dataStorage, const BaseRenderer *renderer, bool withBaseNode)
Return the stack of layers of the given renderer as std::map<int, DataNode::Pointer>, which guarantees ordering of the layers. Stacked layers are only included if they have their "fixedLayer" property set to true and their "layer" property set.
void NodeAdded(const mitk::DataNode *node) override
void RequestUpdate(vtkRenderWindow *renderWindow)
static BaseRenderer * GetByName(const std::string &name)
void DataStorageChanged() override
Class for nodes of the DataTree.
mitk::WeakPointer< mitk::DataStorage > m_DataStorage