diff --git a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestControls.ui b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestControls.ui
index 04d4c4ad16..df889be58d 100644
--- a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestControls.ui
+++ b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestControls.ui
@@ -1,79 +1,93 @@
QmitkDataStorageViewerTestControls
0
0
451
572
0
0
Data storage viewer test
- -
-
+
-
+
Set as selection provider
- -
-
+
-
+
- Set as selection provider
+ Set as selection listener
- -
-
+
-
+
+
+ Set as selection listener
+
+
+
+ -
+
+
+ Set as selection provider
+
+
-
+ -
+
+
-
-
+
+
+ Set as selection provider
+
+
+
+ -
+
Set as selection listner
- -
-
+
-
+
0
40
- -
-
-
- Set as selection provider
-
-
-
QmitkSingleNodeSelectionWidget
QWidget
- QmitkSingleNodeSelectionWidget.h
+ QmitkSingleNodeSelectionWidget.h
1
diff --git a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.cpp b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.cpp
index 006d1d35c3..a08f599516 100644
--- a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.cpp
+++ b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.cpp
@@ -1,110 +1,170 @@
/*===================================================================
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.
===================================================================*/
// data storage viewer test plugin
#include "QmitkDataStorageViewerTestView.h"
// berry
#include
// qt
#include
const std::string QmitkDataStorageViewerTestView::VIEW_ID = "org.mitk.views.datastorageviewertest";
void QmitkDataStorageViewerTestView::SetFocus()
{
// nothing here
}
void QmitkDataStorageViewerTestView::CreateQtPartControl(QWidget* parent)
{
// create GUI widgets
m_Controls.setupUi(parent);
m_DataStorageDefaultListModel = new QmitkDataStorageDefaultListModel(this);
m_DataStorageDefaultListModel->SetDataStorage(GetDataStorage());
m_Controls.selectionListView->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_Controls.selectionListView->setSelectionBehavior(QAbstractItemView::SelectRows);
m_Controls.selectionListView->setAlternatingRowColors(true);
m_Controls.selectionListView->setModel(m_DataStorageDefaultListModel);
m_DataStorageDefaultListModel2 = new QmitkDataStorageDefaultListModel(this);
m_DataStorageDefaultListModel2->SetDataStorage(GetDataStorage());
m_Controls.selectionListView2->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_Controls.selectionListView2->setSelectionBehavior(QAbstractItemView::SelectRows);
m_Controls.selectionListView2->setAlternatingRowColors(true);
m_Controls.selectionListView2->setModel(m_DataStorageDefaultListModel2);
m_ModelViewSelectionConnector = std::make_unique();
try
{
m_ModelViewSelectionConnector->SetView(m_Controls.selectionListView);
}
catch (mitk::Exception& e)
{
mitkReThrow(e) << "Cannot connect the model-view pair signals and slots.";
}
-
m_SelectionServiceConnector = std::make_unique();
- m_SelectionServiceConnector->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
- connect(m_SelectionServiceConnector.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector.get(), SLOT(SetCurrentSelection(QList)));
m_ModelViewSelectionConnector2 = std::make_unique();
try
{
m_ModelViewSelectionConnector2->SetView(m_Controls.selectionListView2);
}
catch (mitk::Exception& e)
{
mitkReThrow(e) << "Cannot connect the model-view pair signals and slots.";
}
-
m_SelectionServiceConnector2 = std::make_unique();
- m_SelectionServiceConnector2->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
- connect(m_SelectionServiceConnector2.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector2.get(), SLOT(SetCurrentSelection(QList)));
+
+ m_SelectionServiceConnector3 = std::make_unique();
connect(m_Controls.selectionProviderCheckBox, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionProvider1(bool)));
connect(m_Controls.selectionProviderCheckBox2, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionProvider2(bool)));
+
+ connect(m_Controls.selectionListenerCheckBox, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionListener1(bool)));
+ connect(m_Controls.selectionListenerCheckBox2, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionListener2(bool)));
+
+ connect(m_Controls.selectionProviderCheckBox3, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionProvider3(bool)));
+ connect(m_Controls.selectionListenerCheckBox3, SIGNAL(toggled(bool)), this, SLOT(SetAsSelectionListener3(bool)));
+
}
void QmitkDataStorageViewerTestView::SetAsSelectionProvider1(bool checked)
{
if (checked)
{
m_SelectionServiceConnector->SetAsSelectionProvider(GetSite()->GetSelectionProvider().Cast().GetPointer());
connect(m_ModelViewSelectionConnector.get(), SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector.get(), SLOT(ChangeServiceSelection(QList)));
}
else
{
m_SelectionServiceConnector->RemoveAsSelectionProvider();
disconnect(m_ModelViewSelectionConnector.get(), SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector.get(), SLOT(ChangeServiceSelection(QList)));
}
}
+void QmitkDataStorageViewerTestView::SetAsSelectionListener1(bool checked)
+{
+ if (checked)
+ {
+ m_SelectionServiceConnector->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
+ connect(m_SelectionServiceConnector.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector.get(), SLOT(SetCurrentSelection(QList)));
+ }
+ else
+ {
+ m_SelectionServiceConnector->RemovePostSelectionListener();
+ disconnect(m_SelectionServiceConnector.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector.get(), SLOT(SetCurrentSelection(QList)));
+
+ }
+}
+
void QmitkDataStorageViewerTestView::SetAsSelectionProvider2(bool checked)
{
if (checked)
{
m_SelectionServiceConnector2->SetAsSelectionProvider(GetSite()->GetSelectionProvider().Cast().GetPointer());
connect(m_ModelViewSelectionConnector2.get(), SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector2.get(), SLOT(ChangeServiceSelection(QList)));
}
else
{
m_SelectionServiceConnector2->RemoveAsSelectionProvider();
disconnect(m_ModelViewSelectionConnector2.get(), SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector2.get(), SLOT(ChangeServiceSelection(QList)));
}
}
+
+void QmitkDataStorageViewerTestView::SetAsSelectionListener2(bool checked)
+{
+ if (checked)
+ {
+ m_SelectionServiceConnector2->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
+ connect(m_SelectionServiceConnector2.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector2.get(), SLOT(SetCurrentSelection(QList)));
+ }
+ else
+ {
+ m_SelectionServiceConnector2->RemovePostSelectionListener();
+ disconnect(m_SelectionServiceConnector2.get(), SIGNAL(ServiceSelectionChanged(QList)), m_ModelViewSelectionConnector2.get(), SLOT(SetCurrentSelection(QList)));
+ }
+}
+
+void QmitkDataStorageViewerTestView::SetAsSelectionProvider3(bool checked)
+{
+ if (checked)
+ {
+ m_SelectionServiceConnector3->SetAsSelectionProvider(GetSite()->GetSelectionProvider().Cast().GetPointer());
+ connect(m_Controls.singleSlot, SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector.get(), SLOT(ChangeServiceSelection(QList)));
+ }
+ else
+ {
+ m_SelectionServiceConnector3->RemoveAsSelectionProvider();
+ disconnect(m_Controls.singleSlot, SIGNAL(CurrentSelectionChanged(QList)), m_SelectionServiceConnector.get(), SLOT(ChangeServiceSelection(QList)));
+ }
+}
+
+void QmitkDataStorageViewerTestView::SetAsSelectionListener3(bool checked)
+{
+ if (checked)
+ {
+ m_SelectionServiceConnector3->AddPostSelectionListener(GetSite()->GetWorkbenchWindow()->GetSelectionService());
+ connect(m_SelectionServiceConnector3.get(), SIGNAL(ServiceSelectionChanged(QList)), m_Controls.singleSlot, SLOT(SetCurrentSelection(QList)));
+ }
+ else
+ {
+ m_SelectionServiceConnector3->RemovePostSelectionListener();
+ disconnect(m_SelectionServiceConnector3.get(), SIGNAL(ServiceSelectionChanged(QList)), m_Controls.singleSlot, SLOT(SetCurrentSelection(QList)));
+ }
+}
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.h b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.h
index 3e2f86faef..24ba825f22 100644
--- a/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.h
+++ b/Plugins/org.mitk.gui.qt.datastorageviewertest/src/internal/QmitkDataStorageViewerTestView.h
@@ -1,65 +1,71 @@
/*===================================================================
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 QMITKDATASTORAGEVIEWERTESTVIEW_H
#define QMITKDATASTORAGEVIEWERTESTVIEW_H
// mitk gui qt common plugin
#include
#include "QmitkModelViewSelectionConnector.h"
#include "QmitkSelectionServiceConnector.h"
// data storage viewer test plugin
#include "ui_QmitkDataStorageViewerTestControls.h"
// qt widgets module
#include "QmitkDataStorageDefaultListModel.h"
/**
* @brief DataStorageViewerTestView
*/
class QmitkDataStorageViewerTestView : public QmitkAbstractView
{
Q_OBJECT
public:
static const std::string VIEW_ID;
protected:
virtual void SetFocus() override;
virtual void CreateQtPartControl(QWidget* parent) override;
private Q_SLOTS:
void SetAsSelectionProvider1(bool checked);
void SetAsSelectionProvider2(bool checked);
+ void SetAsSelectionProvider3(bool checked);
+ void SetAsSelectionListener1(bool checked);
+ void SetAsSelectionListener2(bool checked);
+ void SetAsSelectionListener3(bool checked);
private:
Ui::QmitkDataStorageViewerTestControls m_Controls;
QmitkDataStorageDefaultListModel* m_DataStorageDefaultListModel;
QmitkDataStorageDefaultListModel* m_DataStorageDefaultListModel2;
std::unique_ptr m_ModelViewSelectionConnector;
std::unique_ptr m_SelectionServiceConnector;
std::unique_ptr m_ModelViewSelectionConnector2;
std::unique_ptr m_SelectionServiceConnector2;
+
+ std::unique_ptr m_SelectionServiceConnector3;
};
#endif // QMITKDATASTORAGEVIEWERTESTVIEW_H