SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtReferenceTree.h
1 //=========================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //=========================================================================
10 #ifndef smtk_extension_qt_qtReferenceTree_h
11 #define smtk_extension_qt_qtReferenceTree_h
12 
13 #include "smtk/PublicPointerDefs.h"
14 #include "smtk/extension/qt/MembershipBadge.h"
15 #include "smtk/extension/qt/qtItem.h"
16 #include "smtk/view/PhraseModel.h"
17 
18 namespace smtk
19 {
20 namespace extension
21 {
22 
23 class qtReferenceTreeData;
24 
35 class SMTKQTEXT_EXPORT qtReferenceTree : public qtItem
36 {
37  Q_OBJECT
38  using Superclass = qtItem;
39 
40 public:
42  ~qtReferenceTree() override;
43  void markForDeletion() override;
44  static qtItem* createItemWidget(const qtAttributeItemInfo& info);
45 
46  qt::MembershipCriteria membershipCriteria() const;
47  std::string membershipFilter() const;
48 
49  void setLabelVisible(bool) override;
50 
61  bool setSelectionIconPaths(
62  const std::string& selectedIconPath,
63  const std::string& unselectedIconPath);
64 
66  std::pair<std::string, std::string> selectionIconPaths() const;
67 
69  std::shared_ptr<smtk::view::PhraseModel> phraseModel() const;
70 
71 public Q_SLOTS:
72  void updateItemData() override;
73  virtual void synchronizeMembers();
74 
75 protected Q_SLOTS:
76  void removeObservers();
77 
78  virtual void setOutputOptional(int state);
79 
86  virtual void linkHover(bool link);
87  virtual void linkHoverTrue();
88  virtual void linkHoverFalse();
89 
90  virtual void copyFromSelection();
91  virtual void copyToSelection();
92  virtual void clearItem();
93 
95  void membershipChanged(int val);
96 
97 protected:
103  virtual smtk::view::PhraseModelPtr createPhraseModel() const;
104 
105  void createWidget() override;
106 
107  virtual void clearWidgets();
108  virtual void updateUI();
109 
110  bool eventFilter(QObject* src, QEvent* event) override;
111 
116  virtual void toggleCurrentItem(bool membership);
117 
119  enum class UpdateSource
120  {
121  ITEM_FROM_GUI,
122  GUI_FROM_ITEM,
123  };
124 
126  virtual bool synchronize(UpdateSource src);
127 
129  smtk::extension::qt::MembershipBadge::MemberMap& members() const;
130 
131  void checkRemovedComponents(
134  const std::vector<int>&,
135  const std::vector<int>&,
136  const std::vector<int>&);
137 
138  qtReferenceTreeData* m_p;
139 };
140 } // namespace extension
141 } // namespace smtk
142 
143 #endif
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
smtk::extension::qtItem
an abstract UI class for attribute item
Definition: qtItem.h:61
PublicPointerDefs.h
smtk::extension::qtReferenceTree
A tree-view UI for attribute associations and reference-items.
Definition: qtReferenceTree.h:35
smtk::view::PhraseModelEvent
PhraseModelEvent
Events that can be observed on an smtk::view::PhraseModel.
Definition: PhraseModelObserver.h:26
smtk::extension::qtReferenceTreeData
A base class for protected data shared among subclasses of qtReferenceTree.
Definition: qtReferenceTreeData.h:50
smtk::view::PhraseModelPtr
smtk::shared_ptr< smtk::view::PhraseModel > PhraseModelPtr
Definition: PublicPointerDefs.h:630
smtk::extension::qt::MembershipCriteria
MembershipCriteria
Rules for determining which phrases a membership badge applies to.
Definition: MembershipBadge.h:39
smtk::extension::qtReferenceTree::UpdateSource
UpdateSource
Indicate whether the GUI should be updated from the item it presents or vice versa.
Definition: qtReferenceTree.h:119
smtk::extension::qtAttributeItemInfo
Class used to generate widgets for Attribute Items.
Definition: qtAttributeItemInfo.h:39
smtk::view::DescriptivePhrasePtr
smtk::shared_ptr< smtk::view::DescriptivePhrase > DescriptivePhrasePtr
Definition: PublicPointerDefs.h:620