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 protected Q_SLOTS:
98  virtual void onAdvanceLevelChanged(int levelIdx);
99  void onConfigurationChanged(int levelIdx);
100 
101 protected:
103  void buildUI() override;
105  void makeTopLevel() override;
106 
108  bool checkStatus(const smtk::attribute::Attribute* att) const;
109 
112  virtual bool categoryTest(const smtk::attribute::ItemPtr&) const;
113 
116  virtual bool advanceLevelTest(const smtk::attribute::ItemPtr&) const;
117 
118  void topLevelPrepCategories(
119  const smtk::view::ConfigurationPtr& view,
120  const smtk::attribute::ResourcePtr& attResource);
121  void topLevelPrepConfigurations(
122  const smtk::view::ConfigurationPtr& view,
123  const smtk::attribute::ResourcePtr& attResource);
124  void topLevelPrepAdvanceLevels(const smtk::view::ConfigurationPtr& view);
125  void prepConfigurationComboBox(const std::string& newConfigurationName);
126  void checkConfigurations(smtk::attribute::ItemPtr& item);
127  QScrollArea* m_ScrollArea;
128  bool m_topLevelInitialized;
129  bool m_topLevelCanCreateConfigurations{ false };
130  smtk::attribute::WeakDefinitionPtr m_topLevelConfigurationDef;
131  bool m_ignoreCategories;
132  std::string m_addressString;
133 
134 private:
135  int m_fixedLabelWidth;
136  qtBaseAttributeViewInternals* Internals;
137 
138 }; // class
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
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:50
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:98
smtk::attribute::WeakDefinitionPtr
smtk::weak_ptr< smtk::attribute::Definition > WeakDefinitionPtr
Definition: PublicPointerDefs.h:454