diff --git a/Plugins/org.mitk.gui.qt.viewbrowser/files.cmake b/Plugins/org.mitk.gui.qt.viewbrowser/files.cmake index bedc1fb12f..bf01787e06 100644 --- a/Plugins/org.mitk.gui.qt.viewbrowser/files.cmake +++ b/Plugins/org.mitk.gui.qt.viewbrowser/files.cmake @@ -1,42 +1,42 @@ set(SRC_CPP_FILES - + PluginsTreeViewModel.cpp ) set(INTERNAL_CPP_FILES org_mitk_gui_qt_viewbrowser_Activator.cpp ViewBrowserView.cpp ) set(UI_FILES src/internal/ViewBrowserViewControls.ui ) set(MOC_H_FILES src/internal/org_mitk_gui_qt_viewbrowser_Activator.h src/internal/ViewBrowserView.h ) # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench set(CACHED_RESOURCE_FILES resources/icon.xpm plugin.xml ) # list of Qt .qrc files which contain additional resources # specific to this plugin set(QRC_FILES ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp index f09a4c38bb..47e7f60a87 100644 --- a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp +++ b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.cpp @@ -1,105 +1,138 @@ /*=================================================================== 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. ===================================================================*/ // Blueberry #include #include #include #include // Qmitk #include "ViewBrowserView.h" // Qt #include + #include + #include + #include //mitk image #include const std::string ViewBrowserView::VIEW_ID = "org.mitk.views.viewbrowser"; void ViewBrowserView::SetFocus() { m_Controls.buttonPerformImageProcessing->setFocus(); } void ViewBrowserView::CreateQtPartControl( QWidget *parent ) { // create GUI widgets from the Qt Designer's .ui file m_Controls.setupUi( parent ); connect( m_Controls.buttonPerformImageProcessing, SIGNAL(clicked()), this, SLOT(DoSomething()) ); + + //m_Controls.m_PluginTreeView->setModel(&m_TreeModel); + //m_Controls.m_PluginTreeView->show(); } void ViewBrowserView::OnSelectionChanged( berry::IWorkbenchPart::Pointer /*source*/, const QList& nodes ) { // iterate all selected objects, adjust warning visibility foreach( mitk::DataNode::Pointer node, nodes ) { if( node.IsNotNull() && dynamic_cast(node->GetData()) ) { return; } } } void ViewBrowserView::DoSomething() { + m_TreeModel = new QStandardItemModel ; + QStandardItem *item = m_TreeModel->invisibleRootItem(); + berry::IPerspectiveRegistry* perspRegistry = berry::PlatformUI::GetWorkbench()->GetPerspectiveRegistry(); // QActionGroup* perspGroup = new QActionGroup(menuBar); std::vector perspectives(perspRegistry->GetPerspectives()); bool skip = false; + berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); + std::vector views(viewRegistry->GetViews()); + MITK_INFO << "PERSPECTIVES"; for (unsigned int i=0; i preparedRow =prepareRow("first", "second", "third"); berry::IPerspectiveDescriptor::Pointer p = perspectives.at(i); MITK_INFO << p->GetId(); + QList preparedRow; + preparedRow << new QStandardItem(QString::fromStdString(p->GetLabel())); + preparedRow << new QStandardItem(QString::fromStdString(p->GetId())); + item->appendRow(preparedRow); + + for (unsigned int i=0; i secondRow; + secondRow << new QStandardItem(QString::fromStdString(w->GetLabel())); + secondRow << new QStandardItem(QString::fromStdString(w->GetId())); + preparedRow.first()->appendRow(secondRow); + } // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which // should not appear as an menu-entry in the perspective menu // if (perspectiveExcludeList.size() > 0) // { // for (unsigned int i=0; iGetId()) // { // skip = true; // break; // } // } // if (skip) // { // skip = false; // continue; // } // } // QAction* perspAction = new berry::QtOpenPerspectiveAction(window, // *perspIt, perspGroup); // mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction)); } MITK_INFO << "VIEWS"; - berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); - std::vector views(viewRegistry->GetViews()); - for (unsigned int i=0; iGetId(); - } -} + + + //berry::QTOpenPers + + + // adding a row to the invisible root item produces a root element + //item->appendRow(preparedRow); + + //QList secondRow =prepareRow("111", "222", "333"); + // adding a row to an item starts a subtree + //preparedRow.first()->appendRow(secondRow); + + m_Controls.m_PluginTreeView->setModel(m_TreeModel); + m_Controls.m_PluginTreeView->expandAll(); +} \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.h b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.h index 666767b11e..2d779f9444 100644 --- a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.h +++ b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserView.h @@ -1,65 +1,67 @@ /*=================================================================== 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 ViewBrowserView_h #define ViewBrowserView_h #include #include +#include #include "ui_ViewBrowserViewControls.h" + #include /** \brief ViewBrowserView \warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation. \sa QmitkAbstractView \ingroup ${plugin_target}_internal */ class ViewBrowserView : public QmitkAbstractView { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT public: static const std::string VIEW_ID; protected slots: /// \brief Called when the user clicks the GUI button void DoSomething(); protected: virtual void CreateQtPartControl(QWidget *parent); virtual void SetFocus(); /// \brief called by QmitkFunctionality when DataManager's selection has changed virtual void OnSelectionChanged( berry::IWorkbenchPart::Pointer source, const QList& nodes ); Ui::ViewBrowserViewControls m_Controls; - + QStandardItemModel* m_TreeModel; }; #endif // ViewBrowserView_h diff --git a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserViewControls.ui b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserViewControls.ui index 39d4e14438..2f87993cfa 100644 --- a/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserViewControls.ui +++ b/Plugins/org.mitk.gui.qt.viewbrowser/src/internal/ViewBrowserViewControls.ui @@ -1,54 +1,57 @@ ViewBrowserViewControls 0 0 - 222 - 161 + 752 + 974 0 0 QmitkTemplate + + + Do image processing Do Something Qt::Vertical QSizePolicy::Expanding 20 220