Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkDataStorageFavoriteNodesInspector.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
16 
17 #include "mitkNodePredicateAnd.h"
18 
19 #include "QPushButton"
20 #include "QmitkStyleManager.h"
21 
24 {
25  auto favoriteNodesButton = new QPushButton(parent);
26  QmitkDataStorageListInspector::m_Controls.verticalLayout->addWidget(favoriteNodesButton, 0, Qt::AlignRight);
27 
28  favoriteNodesButton->setIcon(QmitkStyleManager::ThemeIcon(QStringLiteral(":/Qmitk/favorite_remove.svg")));
29  favoriteNodesButton->setIconSize(QSize(24, 24));
30  favoriteNodesButton->setToolTip("Remove selected nodes as favorite");
31 
32  m_FavoriteNodeSelectionPredicate = mitk::NodePredicateProperty::New("org.mitk.selection.favorite", mitk::BoolProperty::New(true));
33  m_NodePredicate = m_FavoriteNodeSelectionPredicate;
34 
35  connect(favoriteNodesButton, &QPushButton::clicked, this, &QmitkDataStorageFavoriteNodesInspector::OnFavoriteNodesButtonClicked);
36 }
37 
39 {
41 
42  combinedPredicate->AddPredicate(m_FavoriteNodeSelectionPredicate);
43  combinedPredicate->AddPredicate(nodePredicate);
44 
46 }
47 
49 {
50  auto selectedNodes = GetSelectedNodes();
51  for (auto node : selectedNodes)
52  {
53  node->SetBoolProperty("org.mitk.selection.favorite", false);
54  }
55 }
static Pointer New()
mitk::NodePredicateBase::ConstPointer m_NodePredicate
Ui_QmitkDataStorageListInspector m_Controls
void SetNodePredicate(const mitk::NodePredicateBase *nodePredicate) override
Overrides the corresponding function of QmitkAbstractDataStorageInspector: The custom favorite nodes ...
virtual void SetNodePredicate(const mitk::NodePredicateBase *nodePredicate)
Sets the node predicate and updates the widget, according to the node predicate.
static Pointer New()
static Pointer New(const char *_arg)
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
static QIcon ThemeIcon(const QByteArray &originalSVG)