SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtAttributeItemInfo.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 qtItem - an abstract UI class for attribute item
11 // .SECTION Description
12 
13 #ifndef smtk_extension_qtAttributeItemInfo_h
14 #define smtk_extension_qtAttributeItemInfo_h
15 
16 #include "smtk/PublicPointerDefs.h"
17 #include "smtk/extension/qt/Exports.h"
18 #include "smtk/view/Configuration.h"
19 #include <QObject>
20 #include <QPointer>
21 
22 namespace smtk
23 {
24 namespace extension
25 {
26 class qtBaseAttributeView;
27 class qtBaseView;
28 class qtUIManager;
29 
38 
39 class SMTKQTEXT_EXPORT qtAttributeItemInfo
40 {
41 public:
45  QPointer<QWidget> parent,
46  qtBaseView* bview);
47 
48  qtAttributeItemInfo() = default;
49  virtual ~qtAttributeItemInfo() = default;
50 
53  void setItem(const smtk::attribute::ItemPtr& item) { m_item = item; }
54  smtk::attribute::ItemPtr item() const { return m_item.lock(); }
55  template<typename ItemType>
56  std::shared_ptr<ItemType> itemAs() const
57  {
58  return std::dynamic_pointer_cast<ItemType>(this->item());
59  }
61 
64  void setComponent(const smtk::view::Configuration::Component& comp) { m_component = comp; }
65  smtk::view::Configuration::Component component() const { return m_component; }
67 
70  void setParentWidget(QPointer<QWidget> widget) { m_parentWidget = widget; }
71  QPointer<QWidget> parentWidget() const { return m_parentWidget; }
73 
75  qtBaseAttributeView* baseView() const;
76 
81  qtUIManager* uiManager() const;
82 
87  std::map<std::string, smtk::view::Configuration::Component>& childrenViewInfo() const;
88 
99  static bool buildFromComponent(
101  qtBaseAttributeView* view,
102  std::map<std::string, qtAttributeItemInfo>& dict);
103 
117 
118  bool createNewDictionary(std::map<std::string, qtAttributeItemInfo>& dict);
119 
120 protected:
123  QPointer<QWidget> m_parentWidget;
124  QPointer<qtBaseAttributeView> m_baseView;
125  std::map<std::string, smtk::view::Configuration::Component> m_childrenViewInfo;
127 }; // class
128 }; // namespace extension
129 }; // namespace smtk
130 
131 #endif
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
PublicPointerDefs.h
smtk::extension::qtUIManager
Container for managers whose content is presented via Qt widgets.
Definition: qtUIManager.h:57
smtk::extension::qtBaseAttributeView
Definition: qtBaseAttributeView.h:29
smtk::extension::qtAttributeItemInfo::m_baseView
QPointer< qtBaseAttributeView > m_baseView
View Definition.
Definition: qtAttributeItemInfo.h:124
smtk::extension::qtBaseView
A base class for all view types implemented using Qt.
Definition: qtBaseView.h:46
smtk::extension::qtAttributeItemInfo::item
smtk::attribute::ItemPtr item() const
Methods to set and retrieve the item to be used by the generated qtItem.
Definition: qtAttributeItemInfo.h:54
smtk::extension::qtAttributeItemInfo::component
smtk::view::Configuration::Component component() const
Methods to set and retrieve the Component Style Information to be used to generate a qtItem.
Definition: qtAttributeItemInfo.h:65
smtk::extension::qtAttributeItemInfo::setItem
void setItem(const smtk::attribute::ItemPtr &item)
Methods to set and retrieve the item to be used by the generated qtItem.
Definition: qtAttributeItemInfo.h:53
smtk::attribute::WeakItemPtr
smtk::weak_ptr< smtk::attribute::Item > WeakItemPtr
Definition: PublicPointerDefs.h:471
smtk::extension::qtAttributeItemInfo::m_component
smtk::view::Configuration::Component m_component
qtItem Component Definition
Definition: qtAttributeItemInfo.h:122
smtk::extension::qtAttributeItemInfo::setComponent
void setComponent(const smtk::view::Configuration::Component &comp)
Methods to set and retrieve the Component Style Information to be used to generate a qtItem.
Definition: qtAttributeItemInfo.h:64
smtk::extension::qtAttributeItemInfo
Class used to generate widgets for Attribute Items.
Definition: qtAttributeItemInfo.h:39
smtk::extension::qtAttributeItemInfo::itemAs
std::shared_ptr< ItemType > itemAs() const
Methods to set and retrieve the item to be used by the generated qtItem.
Definition: qtAttributeItemInfo.h:56
smtk::extension::qtAttributeItemInfo::setParentWidget
void setParentWidget(QPointer< QWidget > widget)
Methods to set and retrieve the widget to be used as the parent for the generated qtItem.
Definition: qtAttributeItemInfo.h:70
smtk::view::Configuration::Component
Configure one item in a view, which may contain children.
Definition: Configuration.h:32
smtk::extension::qtAttributeItemInfo::parentWidget
QPointer< QWidget > parentWidget() const
Methods to set and retrieve the widget to be used as the parent for the generated qtItem.
Definition: qtAttributeItemInfo.h:71
smtk::extension::qtAttributeItemInfo::m_parentWidget
QPointer< QWidget > m_parentWidget
Parent Widget of the qtItem.
Definition: qtAttributeItemInfo.h:123
smtk::attribute::ItemPtr
smtk::shared_ptr< smtk::attribute::Item > ItemPtr
Definition: PublicPointerDefs.h:467
smtk::extension::qtAttributeItemInfo::m_item
smtk::attribute::WeakItemPtr m_item
Pointer to the attribute Item.
Definition: qtAttributeItemInfo.h:121