SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtReferenceItem.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_qtReferenceItem_h
11 #define smtk_extension_qt_qtReferenceItem_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 qtReferenceItemData;
24 
31 class SMTKQTEXT_EXPORT qtReferenceItem : public qtItem
32 {
33  Q_OBJECT
34  using Superclass = qtItem;
35 
36 public:
38  ~qtReferenceItem() override;
39  void markForDeletion() override;
40  static qtItem* createItemWidget(const qtAttributeItemInfo& info);
41 
42  enum AcceptsTypes
43  {
44  NONE,
45  RESOURCES,
46  COMPONENTS,
47  BOTH
48  };
49 
50  AcceptsTypes acceptableTypes() const;
51 
52  void setLabelVisible(bool) override;
53 
64  bool setSelectionIconPaths(
65  const std::string& selectedIconPath,
66  const std::string& unselectedIconPath);
67 
69  std::pair<std::string, std::string> selectionIconPaths() const;
70 
71 public Q_SLOTS:
72  void updateItemData() override;
73 
74 protected Q_SLOTS:
75  void removeObservers();
76 
77  virtual void selectionLinkToggled(bool linked);
78  virtual void setOutputOptional(int state);
79 
88  void popupClosing();
89 
96  virtual void linkHover(bool link);
97  virtual void linkHoverTrue();
98  virtual void linkHoverFalse();
99 
113  virtual void synchronizeAndHide(bool escaping = false);
114 
115  virtual void copyFromSelection();
116  virtual void copyToSelection();
117  virtual void clearItem();
118  virtual void sneakilyHideButtons();
119  virtual void cleverlyShowButtons();
120 
122  void membershipChanged(int val);
123 
124 protected:
130  virtual smtk::view::PhraseModelPtr createPhraseModel() const;
131 
132  void createWidget() override;
133 
134  virtual void clearWidgets();
135  virtual void updateUI();
136 
137  virtual std::string synopsis(bool& membershipValid) const;
138 
139  virtual void updateSynopsisLabels() const;
140 
141  bool eventFilter(QObject* src, QEvent* event) override;
142 
144  virtual void toggleCurrentItem();
145 
147  enum class UpdateSource
148  {
149  ITEM_FROM_GUI,
150  GUI_FROM_ITEM,
151  };
152 
154  virtual bool synchronize(UpdateSource src);
155 
157  smtk::extension::qt::MembershipBadge::MemberMap& members() const;
158 
159  void checkRemovedComponents(
162  const std::vector<int>&,
163  const std::vector<int>&,
164  const std::vector<int>&);
165 
166  qtReferenceItemData* m_p;
167 };
168 } // namespace extension
169 } // namespace smtk
170 
171 #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::qtReferenceItem::UpdateSource
UpdateSource
Indicate whether the GUI should be updated from the item it presents or vice versa.
Definition: qtReferenceItem.h:147
smtk::view::PhraseModelEvent
PhraseModelEvent
Events that can be observed on an smtk::view::PhraseModel.
Definition: PhraseModelObserver.h:26
smtk::view::PhraseModelPtr
smtk::shared_ptr< smtk::view::PhraseModel > PhraseModelPtr
Definition: PublicPointerDefs.h:630
smtk::extension::qtAttributeItemInfo
Class used to generate widgets for Attribute Items.
Definition: qtAttributeItemInfo.h:39
smtk::extension::qtReferenceItemData
A base class for protected data shared between component and resource items.
Definition: qtReferenceItemData.h:50
smtk::extension::qtReferenceItem
A base class for component and resource items.
Definition: qtReferenceItem.h:31
smtk::view::DescriptivePhrasePtr
smtk::shared_ptr< smtk::view::DescriptivePhrase > DescriptivePhrasePtr
Definition: PublicPointerDefs.h:620