SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtBaseAttributeView.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 // .NAME qtBaseAttributeView - a base class for all view types
11 // .SECTION Description
12 
13 #ifndef smtk_extension_qtBaseAttributeView_h
14 #define smtk_extension_qtBaseAttributeView_h
15 
16 #include "smtk/extension/qt/qtBaseView.h"
17 
19 class QScrollArea;
20 
21 namespace smtk
22 {
23 namespace extension
24 {
25 class qtUIManager;
26 class qtItem;
27 class qtViewInfoDialog;
28 
29 class SMTKQTEXT_EXPORT qtBaseAttributeView : public qtBaseView
30 {
31  Q_OBJECT
32 
33 public:
35 
37  ~qtBaseAttributeView() override;
38 
39  void setInitialCategory() override;
40 
47  virtual bool displayItem(smtk::attribute::ItemPtr) const;
48  virtual bool displayItemDefinition(const smtk::attribute::ItemDefinitionPtr&) const;
50  virtual bool isItemWriteable(const smtk::attribute::ItemPtr&) const;
51  virtual void getDefinitions(
53  QList<smtk::attribute::DefinitionPtr>& defs);
54  int fixedLabelWidth() { return m_fixedLabelWidth; }
55 
56  bool setFixedLabelWidth(int w);
57  bool advanceLevelVisible() { return m_advOverlayVisible; }
58  bool useSelectionManager() const { return m_useSelectionManager; }
59 
60  int advanceLevel() const override;
61  bool categoryEnabled() const override;
62  std::string currentCategory() const override;
63 
64  //Returns true if the view does not contain any information to display - the default
65  // behavior is to return false
66  bool isEmpty() const override;
67 
68  // Provide a mechanism to by-pass category filtering
69  void setIgnoreCategories(bool mode);
70  bool ignoreCategories() const { return m_ignoreCategories; }
71 
73  smtk::attribute::ResourcePtr attributeResource() const;
74 
75  // Validates the view information to see if it is suitable for creating a qtAttributeBaseView instance
76  static bool validateInformation(const smtk::view::Information& info);
77 
78 Q_SIGNALS:
79  void modified(smtk::attribute::ItemPtr);
80 
81 public Q_SLOTS:
82 
83  virtual void updateModelAssociation() { ; }
84  virtual void valueChanged(smtk::attribute::ItemPtr);
86  virtual void attributeCreated(const smtk::attribute::AttributePtr&);
88  virtual void attributeChanged(
90  std::vector<std::string> items = std::vector<std::string>());
92  virtual void attributeRemoved(const smtk::attribute::AttributePtr&);
93  void showAdvanceLevel(int i) override;
94  void enableShowBy(int /* enable */) override;
95  void onInfo() override;
96 
97  SMTK_DEPRECATED_IN_21_12("No longer relevant or called.")
98  virtual void requestModelEntityAssociation() { ; }
99 
100 protected Q_SLOTS:
101  virtual void onAdvanceLevelChanged(int levelIdx);
102  void onConfigurationChanged(int levelIdx);
103 
104 protected:
106  void buildUI() override;
108  void makeTopLevel() override;
109 
111  bool checkStatus(const smtk::attribute::Attribute* att) const;
112 
115  virtual bool categoryTest(const smtk::attribute::ItemPtr&) const;
116 
119  virtual bool advanceLevelTest(const smtk::attribute::ItemPtr&) const;
120 
121  void topLevelPrepCategories(
122  const smtk::view::ConfigurationPtr& view,
123  const smtk::attribute::ResourcePtr& attResource);
124  void topLevelPrepConfigurations(
125  const smtk::view::ConfigurationPtr& view,
126  const smtk::attribute::ResourcePtr& attResource);
127  void topLevelPrepAdvanceLevels(const smtk::view::ConfigurationPtr& view);
128  void prepConfigurationComboBox(const std::string& newConfigurationName);
129  void checkConfigurations(smtk::attribute::ItemPtr& item);
130  QScrollArea* m_ScrollArea;
131  bool m_topLevelInitialized;
132  bool m_topLevelCanCreateConfigurations;
133  smtk::attribute::WeakDefinitionPtr m_topLevelConfigurationDef;
134  bool m_ignoreCategories;
135  std::string m_addressString;
136 
137 private:
138  int m_fixedLabelWidth;
139  qtBaseAttributeViewInternals* Internals;
140 
141 }; // class
142 
143 } // namespace extension
144 } // namespace smtk
145 
146 #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
smtk::attribute::DefinitionPtr
smtk::shared_ptr< smtk::attribute::Definition > DefinitionPtr
Definition: PublicPointerDefs.h:450
smtk::extension::qtBaseAttributeView
Definition: qtBaseAttributeView.h:29
smtk::extension::qtBaseView
A base class for all view types implemented using Qt.
Definition: qtBaseView.h:46
smtk::view::Information
A class for information passed to views during initialization.
Definition: Information.h:32
qtBaseAttributeViewInternals
Definition: qtBaseAttributeView.cxx:47
smtk::attribute::AttributePtr
smtk::shared_ptr< smtk::attribute::Attribute > AttributePtr
Definition: PublicPointerDefs.h:456
smtk::view::ConfigurationPtr
smtk::shared_ptr< smtk::view::Configuration > ConfigurationPtr
Definition: PublicPointerDefs.h:642
smtk::attribute::Attribute
Represent a (possibly composite) value according to a definition.
Definition: Attribute.h:43
smtk::attribute::ItemPtr
smtk::shared_ptr< smtk::attribute::Item > ItemPtr
Definition: PublicPointerDefs.h:467
smtk::attribute::ItemDefinitionPtr
smtk::shared_ptr< smtk::attribute::ItemDefinition > ItemDefinitionPtr
Definition: PublicPointerDefs.h:473
smtk::attribute::ResourcePtr
smtk::shared_ptr< smtk::attribute::Resource > ResourcePtr
Definition: PublicPointerDefs.h:604
smtkTypenameMacro
#define smtkTypenameMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:68
smtk::attribute::WeakDefinitionPtr
smtk::weak_ptr< smtk::attribute::Definition > WeakDefinitionPtr
Definition: PublicPointerDefs.h:454