SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtAttribute.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 qtAttribute - a class that encapsulates the UI of an Attribute
11 // .SECTION Description
12 
13 #ifndef smtk_extension_qtAttribute_h
14 #define smtk_extension_qtAttribute_h
15 
16 #include "smtk/PublicPointerDefs.h"
17 #include "smtk/extension/qt/Exports.h"
18 #include "smtk/extension/qt/qtItem.h"
19 #include <QObject>
20 #include <QPointer>
21 #include <QWidget>
22 
24 class QWidget;
25 
26 namespace smtk
27 {
28 namespace extension
29 {
30 
31 class qtBaseView;
32 class qtItem;
33 
34 class SMTKQTEXT_EXPORT qtAttribute : public QObject
35 {
36  Q_OBJECT
37 
38 public:
42  QWidget* parent,
43  qtBaseView* view,
44  bool createWidgetWhenEmpty = false);
45  ~qtAttribute() override;
46 
48  smtk::attribute::AttributePtr attribute() const;
50  QWidget* widget() { return m_widget; }
52  QWidget* parentWidget();
53 
55  virtual void addItem(qtItem*);
57  QList<qtItem*>& items() const;
58  virtual void showAdvanceLevelOverlay(bool show);
59  bool useSelectionManager() const { return m_useSelectionManager; }
60 
62  void createBasicLayout(bool includeAssociations);
63 
65  bool isEmpty() const;
66 
68  bool isValid() const;
69 
72  void removeItems();
73 
74 Q_SIGNALS:
76  void modified();
77  void itemModified(qtItem*);
78 
79 protected:
85  virtual void createWidget(bool createWidgetWhenEmpty = false);
86 
87  QPointer<QWidget> m_widget;
88 
89 protected Q_SLOTS:
90  void onItemModified();
91 
92 private:
93  qtAttributeInternals* m_internals;
94  bool m_useSelectionManager;
95  bool m_isEmpty;
96 };
97 
98 } // namespace extension
99 } // namespace smtk
100 
101 #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::qtBaseView
A base class for all view types implemented using Qt.
Definition: qtBaseView.h:46
smtk::extension::qtAttribute::widget
QWidget * widget()
Return the QT widget that visualizes the attribute.
Definition: qtAttribute.h:50
smtk::attribute::AttributePtr
smtk::shared_ptr< smtk::attribute::Attribute > AttributePtr
Definition: PublicPointerDefs.h:456
smtk::view::Configuration::Component
Configure one item in a view, which may contain children.
Definition: Configuration.h:32
smtk::extension::qtAttribute
Definition: qtAttribute.h:34
qtAttributeInternals
Definition: qtAttribute.cxx:42