diff --git a/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h b/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h index f620e18c33..3a6e8ad903 100644 --- a/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h +++ b/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h @@ -1,126 +1,131 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKABSTRACTDATASTORAGEINSPECTOR_H #define QMITKABSTRACTDATASTORAGEINSPECTOR_H #include #include // mitk core #include #include // qt #include class QAbstractItemVew; -/* -* @brief This abstract class for convienient widgets that over a specific view onto a given DataStorage instance to -* inspect its contents. One may also get the selection in this inspector of the data storage. +/** +* @brief This abstract class is a convinient base class for easy implementation of widgets that +* offer a specific view onto a given DataStorage instance to inspect its contents. +* One may also get the selection in this inspector of the data storage. */ class MITKQTWIDGETS_EXPORT QmitkAbstractDataStorageInspector : public QWidget { Q_OBJECT public: virtual ~QmitkAbstractDataStorageInspector(); - /* - * @brief Sets the data storage that will be used /monitored by widget. + /** + * @brief Sets the data storage that will be used /monitored by the widget. * - * @par dataStorage A pointer to the data storage to set. + * @param dataStorage A pointer to the data storage to set. */ void SetDataStorage(mitk::DataStorage* dataStorage); - /* + /** * @brief Sets the node predicate and updates the widget, according to the node predicate. * - * @par nodePredicate A pointer to node predicate. + * @param nodePredicate A pointer to node predicate. */ virtual void SetNodePredicate(mitk::NodePredicateBase* nodePredicate); mitk::NodePredicateBase* GetNodePredicate() const; using NodeList = QList; + /** Returns the list of currently selected nodes.*/ NodeList GetSelectedNodes() const; + /** Returns an pointer to the view that is used in the inspector to show the content.*/ virtual QAbstractItemView* GetView() = 0; - virtual QAbstractItemView* GetView() const = 0; + virtual const QAbstractItemView* GetView() const = 0; + /** Returns the setting of the internal connector. It can be changed by SetSelectOnlyVisibleNodes()*/ bool GetSelectOnlyVisibleNodes() const; using SelectionMode = QAbstractItemView::SelectionMode; + /** Sets the selection mode of the inspector.*/ virtual void SetSelectionMode(SelectionMode mode) = 0; virtual SelectionMode GetSelectionMode() const = 0; Q_SIGNALS: - /* + /** * @brief A signal that will be emitted if the selected node has changed. * - * @par nodes A list of data nodes that are newly selected. + * @param nodes A list of data nodes that are newly selected. */ void CurrentSelectionChanged(NodeList nodes); public Q_SLOTS: - /* + /** * @brief Change the selection modus of the item view's selection model. * * If true, an incoming selection will be filtered (reduced) to only those nodes that are visible by the current view. * An outgoing selection can then at most contain the filtered nodes. * If false, the incoming non-visible selection will be stored and later added to the outgoing selection, * to include the original selection that could not be modified. * The part of the original selection, that is non-visible are the nodes that are not * - * @par selectOnlyVisibleNodes The bool value to define the selection modus. + * @param selectOnlyVisibleNodes The bool value to define the selection modus. */ void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes); - /* + /** * @brief Transform a list of data nodes into a model selection and set this as a new selection of the * selection model of the private member item view. * * The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If * necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case * the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable * in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection * but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes'). * - * @par nodes A list of data nodes that should be newly selected. + * @param nodes A list of data nodes that should be newly selected. */ void SetCurrentSelection(NodeList selectedNodes); protected Q_SLOTS: void OnSelectionChanged(NodeList selectedNodes); protected: - /** Helper function is called if data storage or predicate is changed to (re) inizialze the widget correctly. + /** Helper function is called if data storage or predicate is changed to (re) initialize the widget correctly. Implement the function in derived classes.*/ virtual void Initialize() = 0; mitk::WeakPointer m_DataStorage; mitk::NodePredicateBase::Pointer m_NodePredicate; std::unique_ptr m_Connector; QmitkAbstractDataStorageInspector(QWidget* parent = nullptr); }; #endif // QMITKABSTRACTDATASTORAGEMODEL_H diff --git a/Modules/QtWidgets/include/QmitkAbstractDataStorageModel.h b/Modules/QtWidgets/include/QmitkAbstractDataStorageModel.h index 1c2ac385a5..30faaec032 100644 --- a/Modules/QtWidgets/include/QmitkAbstractDataStorageModel.h +++ b/Modules/QtWidgets/include/QmitkAbstractDataStorageModel.h @@ -1,92 +1,92 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKABSTRACTDATASTORAGEMODEL_H #define QMITKABSTRACTDATASTORAGEMODEL_H #include // mitk core #include #include #include // qt #include /* -* @brief This abstract class extends the 'QAbstractItemModel' to accept an 'mitk::DataStorage' and a 'mitk::NodePredicateBase'., +* @brief This abstract class extends the 'QAbstractItemModel' to accept an 'mitk::DataStorage' and a 'mitk::NodePredicateBase'. * It registers itself as a node event listener of the data storage. * The 'QmitkAbstractDataStorageModel' provides three empty functions, 'NodeAdded', 'NodeChanged' and 'NodeRemoved', that -* may be implemented by the subclasses. These functions allow to react to the 'AddNodeEvent', 'ChangedNodeEvent' and -* 'RemoveNodeEvent' of the data storage. This might be useful to force an update on the custom view to correctly +* may be implemented by subclasses. These functions allow to react to the 'AddNodeEvent', 'ChangedNodeEvent' and +* 'RemoveNodeEvent' of the data storage. This might be useful to force an update on a custom view to correctly * represent the content of the data storage. * -* A concrete implementations of this class is used to store the temporarily shown data nodes of the data storage. +* A concrete implementation of this class is used to store the temporarily shown data nodes of the data storage. * These nodes may be a subset of all the nodes inside the data storage, if a specific node predicate is set. * * A model that implements this class has to return mitk::DataNode::Pointer objects for model indexes when the * role is QmitkDataNodeRole. */ class MITKQTWIDGETS_EXPORT QmitkAbstractDataStorageModel : public QAbstractItemModel { Q_OBJECT public: virtual ~QmitkAbstractDataStorageModel(); /* * @brief Sets the data storage and adds listener for node events. * - * @par dataStorage A pointer to the data storage to set. + * @param dataStorage A pointer to the data storage to set. */ void SetDataStorage(mitk::DataStorage* dataStorage); mitk::DataStorage* GetDataStorage() { return m_DataStorage.Lock().GetPointer(); } /* * @brief Sets the node predicate and updates the model data, according to the node predicate. * - * @par nodePredicate A pointer to node predicate. + * @param nodePredicate A pointer to node predicate. */ void SetNodePredicate(mitk::NodePredicateBase* nodePredicate); mitk::NodePredicateBase* GetNodePredicate() { return m_NodePredicate; } protected: virtual void DataStorageChanged() = 0; virtual void NodePredicateChanged() = 0; virtual void NodeAdded(const mitk::DataNode* node) = 0; virtual void NodeChanged(const mitk::DataNode* node) = 0; virtual void NodeRemoved(const mitk::DataNode* node) = 0; QmitkAbstractDataStorageModel(QObject* parent = nullptr); QmitkAbstractDataStorageModel(mitk::DataStorage* dataStorage, QObject* parent = nullptr); mitk::WeakPointer m_DataStorage; mitk::NodePredicateBase::Pointer m_NodePredicate; private: /** Helper triggered on the storage delete event */ void SetDataStorageDeleted(); unsigned long m_DataStorageDeletedTag; }; #endif // QMITKABSTRACTDATASTORAGEMODEL_H diff --git a/Modules/QtWidgets/include/QmitkDataStorageInspectorGenerator.h b/Modules/QtWidgets/include/QmitkDataStorageInspectorGenerator.h index bdeeb19c02..d8fc1dd641 100644 --- a/Modules/QtWidgets/include/QmitkDataStorageInspectorGenerator.h +++ b/Modules/QtWidgets/include/QmitkDataStorageInspectorGenerator.h @@ -1,44 +1,41 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QmitkDataStorageInspectorGenerator_H #define QmitkDataStorageInspectorGenerator_H #include "QmitkIDataStorageInspectorProvider.h" #include class MITKQTWIDGETS_EXPORT QmitkDataStorageInspectorGenerator { public: using IDType = std::string; using ProviderMapType = std::map; static ProviderMapType GetProviders(); static mitk::IDataStorageInspectorProvider *GetProvider(const IDType &id); protected: QmitkDataStorageInspectorGenerator(); virtual ~QmitkDataStorageInspectorGenerator(); - -private: - // No copy constructor allowed - QmitkDataStorageInspectorGenerator(const QmitkDataStorageInspectorGenerator &source); - void operator=(const QmitkDataStorageInspectorGenerator &); // purposely not implemented + QmitkDataStorageInspectorGenerator(const QmitkDataStorageInspectorGenerator &source) = delete; + QmitkDataStorageInspectorGenerator& operator=(const QmitkDataStorageInspectorGenerator &) = delete; }; #endif diff --git a/Modules/QtWidgets/include/QmitkDataStorageInspectorProviderBase.h b/Modules/QtWidgets/include/QmitkDataStorageInspectorProviderBase.h index c6d8c07db3..2e964cf019 100644 --- a/Modules/QtWidgets/include/QmitkDataStorageInspectorProviderBase.h +++ b/Modules/QtWidgets/include/QmitkDataStorageInspectorProviderBase.h @@ -1,80 +1,79 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ -#ifndef __QMITK_DATA_STORAGE_INSPECTOR_PROVIDER_H -#define __QMITK_DATA_STORAGE_INSPECTOR_PROVIDER_H +#ifndef __QMITK_DATA_STORAGE_INSPECTOR_PROVIDER_BASE_H +#define __QMITK_DATA_STORAGE_INSPECTOR_PROVIDER_BASE_H #include // Microservices #include #include #include // MITK #include /** * @brief Base class for DataStorage inspector provider. */ template class QmitkDataStorageInspectorProviderBase : public mitk::IDataStorageInspectorProvider { public: virtual QmitkAbstractDataStorageInspector* CreateInspector() const override; virtual std::string GetInspectorID() const override; virtual std::string GetInspectorDisplayName() const override; virtual std::string GetInspectorDescription() const override; us::ServiceRegistration RegisterService( us::ModuleContext *context = us::GetModuleContext()); void UnregisterService(); QmitkDataStorageInspectorProviderBase(const std::string& id); QmitkDataStorageInspectorProviderBase(const std::string& id, const std::string& displayName, const std::string& desc= "" ); virtual ~QmitkDataStorageInspectorProviderBase(); protected: QmitkDataStorageInspectorProviderBase(const QmitkDataStorageInspectorProviderBase &other); + QmitkDataStorageInspectorProviderBase &operator=(const QmitkDataStorageInspectorProviderBase &other) = delete; virtual us::ServiceProperties GetServiceProperties() const; /** * \brief Set the service ranking for this file reader. * * Default is zero and should only be chosen differently for a reason. * The ranking is used to determine which reader to use if several * equivalent providers have been found. * It may be used to replace a default provider from MITK in your own project. */ void SetRanking(int ranking); int GetRanking() const; private: - QmitkDataStorageInspectorProviderBase &operator=(const QmitkDataStorageInspectorProviderBase &other); - class Impl; std::unique_ptr d; }; #ifndef ITK_MANUAL_INSTANTIATION #include "QmitkDataStorageInspectorProviderBase.tpp" #endif #endif /* __MODEL_FIT_PROVIDER_BASE_H */ diff --git a/Modules/QtWidgets/include/QmitkDataStorageListInspector.h b/Modules/QtWidgets/include/QmitkDataStorageListInspector.h index 978b7b0f8d..393469b6f3 100644 --- a/Modules/QtWidgets/include/QmitkDataStorageListInspector.h +++ b/Modules/QtWidgets/include/QmitkDataStorageListInspector.h @@ -1,50 +1,50 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKDATASTORAGELISTVIEWWIDGET_H #define QMITKDATASTORAGELISTVIEWWIDGET_H #include #include #include #include "ui_QmitkDataStorageListInspector.h" /* * @brief This is an inspector that offers a simple list view on a data storage. */ class MITKQTWIDGETS_EXPORT QmitkDataStorageListInspector : public QmitkAbstractDataStorageInspector { Q_OBJECT public: QmitkDataStorageListInspector(QWidget* parent = nullptr); virtual QAbstractItemView* GetView() override; - virtual QAbstractItemView* GetView() const override; + virtual const QAbstractItemView* GetView() const override; virtual void SetSelectionMode(SelectionMode mode) override; virtual SelectionMode GetSelectionMode() const override; protected: virtual void Initialize() override; QmitkAbstractDataStorageModel* m_StorageModel; Ui_QmitkDataStorageListInspector m_Controls; }; #endif // QMITKABSTRACTDATASTORAGEMODEL_H diff --git a/Modules/QtWidgets/include/QmitkDataStorageTreeInspector.h b/Modules/QtWidgets/include/QmitkDataStorageTreeInspector.h index dbbca49d37..90e90de04b 100644 --- a/Modules/QtWidgets/include/QmitkDataStorageTreeInspector.h +++ b/Modules/QtWidgets/include/QmitkDataStorageTreeInspector.h @@ -1,52 +1,52 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKDATASTORAGETREEINSPECTOR_H #define QMITKDATASTORAGETREEINSPECTOR_H #include #include #include #include "ui_QmitkDataStorageTreeInspector.h" /* * @brief This is an inspector that offers a simple tree view on a data storage. * Something like the "data manager plugin", but in simple/light (with less functionality) * It uses the QmitkDataStorageSimpleTreeModel. */ class MITKQTWIDGETS_EXPORT QmitkDataStorageTreeInspector : public QmitkAbstractDataStorageInspector { Q_OBJECT public: QmitkDataStorageTreeInspector(QWidget* parent = nullptr); virtual QAbstractItemView* GetView() override; - virtual QAbstractItemView* GetView() const override; + virtual const QAbstractItemView* GetView() const override; virtual void SetSelectionMode(SelectionMode mode) override; virtual SelectionMode GetSelectionMode() const override; protected: virtual void Initialize() override; QmitkAbstractDataStorageModel* m_StorageModel; Ui_QmitkDataStorageTreeInspector m_Controls; }; #endif // QMITKABSTRACTDATASTORAGEMODEL_H diff --git a/Modules/QtWidgets/include/QmitkIDataStorageInspectorProvider.h b/Modules/QtWidgets/include/QmitkIDataStorageInspectorProvider.h index 5ccbe14c0f..d5cfb53ede 100644 --- a/Modules/QtWidgets/include/QmitkIDataStorageInspectorProvider.h +++ b/Modules/QtWidgets/include/QmitkIDataStorageInspectorProvider.h @@ -1,71 +1,71 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __I_ABSTRACT_DATA_STORAGE_PROVIDER_H #define __I_ABSTRACT_DATA_STORAGE_PROVIDER_H #include #include class QmitkAbstractDataStorageInspector; namespace mitk { /** * \ingroup MicroServices_Interfaces * * \brief The common interface for all DataStorage inspector providers. * * Implementations of this interface must be registered as a service * to make themselves available via the service registry. * * It is recommended to derive new implementations from QmitkDataStorageInspectorProviderBase * which provide correct service registration semantics. * * \sa QmitkDataStorageInspectorProviderBase */ struct MITKQTWIDGETS_EXPORT IDataStorageInspectorProvider { virtual ~IDataStorageInspectorProvider(); /** - * \brief returns a inspector instance represented by the provider. + * \brief returns an inspector instance represented by the provider. */ virtual QmitkAbstractDataStorageInspector* CreateInspector() const = 0; /** Return the uniqe ID for the inspector type provided.*/ virtual std::string GetInspectorID() const = 0; /** Return the display name (e.g. used in the UI) for the inspector type provided.*/ virtual std::string GetInspectorDisplayName() const = 0; /** Returns a description of the inspector type provided.*/ virtual std::string GetInspectorDescription() const = 0; /** * @brief Service property name for the inspector ID. * * The property value must be of type \c std::string. * * @return The property name. */ static std::string PROP_INSPECTOR_ID(); }; } // namespace mitk MITK_DECLARE_SERVICE_INTERFACE(mitk::IDataStorageInspectorProvider, "org.mitk.IDataStorageInspectorProvider") #endif /* __I_MODEL_FIT_PROVIDER_H */ diff --git a/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h b/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h index a7a623ddc4..5b2d361a58 100644 --- a/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h +++ b/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h @@ -1,154 +1,155 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITKMODELVIEWSELECTIONCONNECTOR_H #define QMITKMODELVIEWSELECTIONCONNECTOR_H #include // qt widgets module #include // qt #include /** * @brief The 'QmitkModelViewSelectionConnector' is used to handle the selections of a model-view-pair. * * The class accepts a view and a model, which are used to react to selection changes. This class is able to propagate selection changes * to and receive from its surrounding class. * * The model-view-pair can be added as a selection listener to a selection service. This should be done by using 'AddPostSelectionListener' * with the existing selection service of the surrounding 'QmitkAbstractView'. * The model-view-pair can be set as a selection provider. This should be done by using 'SetAsSelectionProvider' with the existing * selection provider of the surrounding 'QmitkAbstractView'. * * The 'QmitkModelViewSelectionConnector' offers a public slot and signal that can be used to set / propagate the selected * nodes in the current view: * The 'SetCurrentSelection'-slot finds the indices of the given selected nodes in its internal data storage model and -* changes the selection of the accordingly. -* The 'CurrentSelectionChanged'-signal sends a list of selected nodes to it's environment. +* changes the selection of the internal data storage model accordingly. +* The 'CurrentSelectionChanged'-signal sends a list of selected nodes to its environment. * The 'CurrentSelectionChanged'-signal is emitted by the 'ChangeModelSelection'-function, which transforms the internal item view's * selection into a data node list. The 'ChangeModelSelection'-function is called whenever the selection of the item view's * selection model changes. */ class MITKQTWIDGETS_EXPORT QmitkModelViewSelectionConnector : public QObject { Q_OBJECT public: QmitkModelViewSelectionConnector(); /** * @brief Set the view whose selection model is used to propagate or receive selection changes. Use the view's data model * to transform selected nodes into model indexes and vice versa. * * @pre The view's data model needs to be a 'QmitkAbstractDataStorageModel'. If so, the data model is received from * the view and stored as a private member. * The data model must return 'mitk::DataNode::Pointer' objects for model indexes if the role is 'QmitkDataNodeRole'. * @throw mitk::Exception, if the view is invalid or the view's data model is not a valid 'QmitkAbstractDataStorageModel'. * - * @par view The view to set. + * @param view The view to set. */ void SetView(QAbstractItemView* view); /** * @brief Retrieve the currently selected nodes (equals the last CurrentSelectionChanged values). */ QList GetSelectedNodes() const; bool GetSelectOnlyVisibleNodes() const; Q_SIGNALS: /** * @brief A signal that will be emitted by the 'ChangeModelSelection'-function. This happens if the selection model * of the private member item view has changed. * - * @par nodes A list of data nodes that are newly selected. + * @param nodes A list of data nodes that are newly selected. */ void CurrentSelectionChanged(QList nodes); public Q_SLOTS: /** - * @brief Change the selection modus of the item view's selection model. + * @brief Change the selection mode of the item view's selection model. * - * If true, an incoming selection will be filtered (reduced) to only those nodes that are visible by the current view. + * If true, an incoming selection will be filtered (reduced) to only those nodes that are visible to the current view. * An outgoing selection can then at most contain the filtered nodes. * If false, the incoming non-visible selection will be stored and later added to the outgoing selection, - * to include the original selection that could not be modified. - * The part of the original selection, that is non-visible are the nodes that are not + * to include the part of the original selection that was not visible. + * The part of the original selection, that is non-visible are the nodes that do not met the predicate of the + * associated QmitkAbstractDataStorageModel. * - * @par selectOnlyVisibleNodes The bool value to define the selection modus. + * @param selectOnlyVisibleNodes The bool value to define the selection modus. */ void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes); /** * @brief Transform a list of data nodes into a model selection and set this as a new selection of the * selection model of the private member item view. * * The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If * necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case * the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable * in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection * but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes'). * - * @par nodes A list of data nodes that should be newly selected. + * @param nodes A list of data nodes that should be newly selected. */ void SetCurrentSelection(QList selectedNodes); private Q_SLOTS: /** * @brief Transform a model selection into a data node list and emit the 'CurrentSelectionChanged'-signal. * * The function adds the selected nodes from the original selection that could not be modified, if * 'm_SelectOnlyVisibleNodes' is false. * This slot is internally connected to the 'selectionChanged'-signal of the selection model of the private member item view. * - * @par selected The newly selected items. - * @par deselected The newly deselected items. + * @param selected The newly selected items. + * @param deselected The newly deselected items. */ void ChangeModelSelection(const QItemSelection& selected, const QItemSelection& deselected); private: QmitkAbstractDataStorageModel* m_Model; QAbstractItemView* m_View; bool m_SelectOnlyVisibleNodes; QList m_NonVisibleSelection; /* * @brief Retrieve the currently selected nodes from the selection model of the private member item view by * transforming the selection indexes into a data node list. * * In order to transform the indices into data nodes, the private data storage model must return * 'mitk::DataNode::Pointer' objects for model indexes if the role is QmitkDataNodeRole. */ QList GetInternalSelectedNodes() const; /* * @brief Filter the list of given nodes such that only those nodes are used that are valid * when using the data storage model's node predicate. * If no node predicate was set or the data storage model is invalid, the input list * of given nodes is returned. */ QList FilterNodeList(const QList& nodes) const; }; /* * @brief Return true, if the nodes in the list of two given selections are equal (Sorting is ignored. Any permutation is valid.)*/ bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList& selection1, const QList& selection2); #endif // QMITKMODELVIEWSELECTIONCONNECTOR_H diff --git a/Modules/QtWidgets/src/QmitkDataStorageListInspector.cpp b/Modules/QtWidgets/src/QmitkDataStorageListInspector.cpp index ff909e25bd..a5d3182d1f 100644 --- a/Modules/QtWidgets/src/QmitkDataStorageListInspector.cpp +++ b/Modules/QtWidgets/src/QmitkDataStorageListInspector.cpp @@ -1,61 +1,61 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include QmitkDataStorageListInspector::QmitkDataStorageListInspector(QWidget* parent/* = nullptr*/) : QmitkAbstractDataStorageInspector(parent) { m_Controls.setupUi(this); m_Controls.view->setSelectionMode(QAbstractItemView::ExtendedSelection); m_Controls.view->setSelectionBehavior(QAbstractItemView::SelectRows); m_Controls.view->setAlternatingRowColors(true); m_StorageModel = new QmitkDataStorageDefaultListModel(this); m_Controls.view->setModel(m_StorageModel); } QAbstractItemView* QmitkDataStorageListInspector::GetView() { return m_Controls.view; }; -QAbstractItemView* QmitkDataStorageListInspector::GetView() const +const QAbstractItemView* QmitkDataStorageListInspector::GetView() const { return m_Controls.view; }; void QmitkDataStorageListInspector::Initialize() { m_StorageModel->SetDataStorage(m_DataStorage.Lock()); m_StorageModel->SetNodePredicate(m_NodePredicate); m_Connector->SetView(m_Controls.view); } void QmitkDataStorageListInspector::SetSelectionMode(SelectionMode mode) { m_Controls.view->setSelectionMode(mode); } QmitkDataStorageListInspector::SelectionMode QmitkDataStorageListInspector::GetSelectionMode() const { return m_Controls.view->selectionMode(); }; diff --git a/Modules/QtWidgets/src/QmitkDataStorageTreeInspector.cpp b/Modules/QtWidgets/src/QmitkDataStorageTreeInspector.cpp index e82eccdf68..c8bb5c952b 100644 --- a/Modules/QtWidgets/src/QmitkDataStorageTreeInspector.cpp +++ b/Modules/QtWidgets/src/QmitkDataStorageTreeInspector.cpp @@ -1,65 +1,65 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include QmitkDataStorageTreeInspector::QmitkDataStorageTreeInspector(QWidget* parent/* = nullptr*/) : QmitkAbstractDataStorageInspector(parent) { m_Controls.setupUi(this); m_Controls.view->setSelectionMode(QAbstractItemView::ExtendedSelection); m_Controls.view->setSelectionBehavior(QAbstractItemView::SelectRows); m_Controls.view->setAlternatingRowColors(true); m_Controls.view->setHeaderHidden(true); m_Controls.view->setTextElideMode(Qt::ElideMiddle); m_StorageModel = new QmitkDataStorageSimpleTreeModel(this); m_Controls.view->setModel(m_StorageModel); } QAbstractItemView* QmitkDataStorageTreeInspector::GetView() { return m_Controls.view; }; -QAbstractItemView* QmitkDataStorageTreeInspector::GetView() const +const QAbstractItemView* QmitkDataStorageTreeInspector::GetView() const { return m_Controls.view; }; void QmitkDataStorageTreeInspector::Initialize() { m_StorageModel->SetDataStorage(m_DataStorage.Lock()); m_StorageModel->SetNodePredicate(m_NodePredicate); m_Connector->SetView(m_Controls.view); m_Controls.view->expandAll(); } void QmitkDataStorageTreeInspector::SetSelectionMode(SelectionMode mode) { m_Controls.view->setSelectionMode(mode); } QmitkDataStorageTreeInspector::SelectionMode QmitkDataStorageTreeInspector::GetSelectionMode() const { return m_Controls.view->selectionMode(); }; diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h b/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h index d2a4391ab9..02f828bcc5 100644 --- a/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h +++ b/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h @@ -1,127 +1,127 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITK_NODE_SELECTION_DIALOG_H #define QMITK_NODE_SELECTION_DIALOG_H #include #include #include #include #include "org_mitk_gui_qt_common_Export.h" #include "ui_QmitkNodeSelectionDialog.h" #include /** * \class QmitkNodeSelectionDialog * \brief Widget that allows to show and edit the content of an mitk::IsoDoseLevel instance. */ class MITK_QT_COMMON QmitkNodeSelectionDialog : public QDialog { Q_OBJECT public: explicit QmitkNodeSelectionDialog(QWidget* parent = nullptr, QString caption = "", QString hint = ""); /* * @brief Sets the data storage that will be used /monitored by widget. * - * @par dataStorage A pointer to the data storage to set. + * @param dataStorage A pointer to the data storage to set. */ void SetDataStorage(mitk::DataStorage* dataStorage); /* * @brief Sets the node predicate and updates the widget, according to the node predicate. * - * @par nodePredicate A pointer to node predicate. + * @param nodePredicate A pointer to node predicate. */ virtual void SetNodePredicate(mitk::NodePredicateBase* nodePredicate); mitk::NodePredicateBase* GetNodePredicate() const; using NodeList = QList; NodeList GetSelectedNodes() const; bool GetSelectOnlyVisibleNodes() const; using SelectionMode = QAbstractItemView::SelectionMode; void SetSelectionMode(SelectionMode mode); SelectionMode GetSelectionMode() const; Q_SIGNALS: /* * @brief A signal that will be emitted if the selected node has changed. * - * @par nodes A list of data nodes that are newly selected. + * @param nodes A list of data nodes that are newly selected. */ void CurrentSelectionChanged(NodeList nodes); public Q_SLOTS: /* * @brief Change the selection modus of the item view's selection model. * * If true, an incoming selection will be filtered (reduced) to only those nodes that are visible by the current view. * An outgoing selection can then at most contain the filtered nodes. * If false, the incoming non-visible selection will be stored and later added to the outgoing selection, * to include the original selection that could not be modified. * The part of the original selection, that is non-visible are the nodes that are not * - * @par selectOnlyVisibleNodes The bool value to define the selection modus. + * @param selectOnlyVisibleNodes The bool value to define the selection modus. */ void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes); /* * @brief Transform a list of data nodes into a model selection and set this as a new selection of the * selection model of the private member item view. * * The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If * necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case * the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable * in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection * but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes'). * - * @par nodes A list of data nodes that should be newly selected. + * @param nodes A list of data nodes that should be newly selected. */ void SetCurrentSelection(NodeList selectedNodes); protected Q_SLOTS: void OnSelectionChanged(NodeList selectedNodes); void OnOK(); void OnCancel(); protected: void AddPanel(QmitkAbstractDataStorageInspector* view, QString name, QString desc); mitk::WeakPointer m_DataStorage; mitk::NodePredicateBase::Pointer m_NodePredicate; bool m_SelectOnlyVisibleNodes; NodeList m_SelectedNodes; SelectionMode m_SelectionMode; using PanelVectorType = std::vector; PanelVectorType m_Panels; Ui_QmitkNodeSelectionDialog m_Controls; }; #endif // QmitkNodeSelectionDialog_H diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkSingleNodeSelectionWidget.h b/Plugins/org.mitk.gui.qt.common/src/QmitkSingleNodeSelectionWidget.h index d56841a315..9fbe2c040d 100644 --- a/Plugins/org.mitk.gui.qt.common/src/QmitkSingleNodeSelectionWidget.h +++ b/Plugins/org.mitk.gui.qt.common/src/QmitkSingleNodeSelectionWidget.h @@ -1,84 +1,84 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef QMITK_SINGLE_NODE_SELECTION_WIDGET_H #define QMITK_SINGLE_NODE_SELECTION_WIDGET_H #include #include #include #include #include "org_mitk_gui_qt_common_Export.h" #include "ui_QmitkSingleNodeSelectionWidget.h" #include #include class QmitkAbstractDataStorageModel; /** * \class QmitkSingleNodeSelectionWidget * \brief Widget that that represents a node selection. It acts like a button. Clicking on it * allows to change the selection. */ class MITK_QT_COMMON QmitkSingleNodeSelectionWidget : public QmitkAbstractNodeSelectionWidget { Q_OBJECT public: explicit QmitkSingleNodeSelectionWidget(QWidget* parent = nullptr); ~QmitkSingleNodeSelectionWidget(); mitk::DataNode::Pointer GetSelectedNode() const; using NodeList = QmitkAbstractNodeSelectionWidget::NodeList; Q_SIGNALS: /* * @brief A signal that will be emitted if the selected node has changed. * - * @par nodes A list of data nodes that are newly selected. + * @param nodes A list of data nodes that are newly selected. */ void CurrentSelectionChanged(QList nodes); public Q_SLOTS: virtual void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes) override; virtual void SetCurrentSelection(NodeList selectedNodes) override; protected Q_SLOTS: virtual void OnClearSelection(); protected: mitk::DataNode::Pointer ExtractCurrentValidSelection(const NodeList& nodes) const; NodeList CompileEmitSelection() const; virtual bool eventFilter(QObject *obj, QEvent *ev) override; void EditSelection(); virtual void UpdateInfo() override; virtual void OnNodePredicateChanged(mitk::NodePredicateBase* newPredicate); NodeList m_ExternalSelection; mitk::DataNode::Pointer m_SelectedNode; Ui_QmitkSingleNodeSelectionWidget m_Controls; }; #endif // QmitkSingleNodeSelectionWidget_H