SMTK  @SMTK_VERSION@
Simulation Modeling Tool Kit
qtResourceBrowser.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_qtResourceBrowser_h
11 #define smtk_extension_qtResourceBrowser_h
12 
13 #include "smtk/extension/qt/Exports.h"
14 #include "smtk/extension/qt/qtBaseView.h"
15 
16 #include "smtk/common/TypeContainer.h"
17 
18 #include "smtk/PublicPointerDefs.h"
19 
20 #include <QWidget>
21 
22 class QAbstractItemModel;
23 class QItemSelection;
24 class QTreeView;
25 
26 namespace smtk
27 {
28 namespace extension
29 {
30 
31 class qtDescriptivePhraseModel;
32 
51 class SMTKQTEXT_EXPORT qtResourceBrowser : public qtBaseView
52 {
53  Q_OBJECT
55 
56 public:
58 
59  static qtBaseView* createViewWidget(const smtk::view::Information& info);
61  ~qtResourceBrowser() override;
62 
63  static QTreeView* createDefaultView(QWidget* parent);
64  QTreeView* view() const;
65 
66  smtk::view::PhraseModelPtr phraseModel() const;
67  void setPhraseModel(const smtk::view::PhraseModelPtr&);
68 
69  smtk::view::SubphraseGeneratorPtr phraseGenerator() const;
70  void setPhraseGenerator(smtk::view::SubphraseGeneratorPtr spg);
71 
72  smtk::extension::qtDescriptivePhraseModel* descriptivePhraseModel() const;
73  void setDescriptivePhraseModel(QAbstractItemModel* qmodel);
74 
75  bool highlightOnHover() const;
76  void setHighlightOnHover(bool highlight);
77 
79  static const std::string& getJSONConfiguration() { return s_configurationJSON; }
80 
81 public Q_SLOTS:
82  virtual void sendPanelSelectionToSMTK(
83  const QItemSelection& selected,
84  const QItemSelection& deselected);
85  virtual void sendSMTKSelectionToPanel(const std::string& src, smtk::view::SelectionPtr seln);
86 
87  virtual void addSource(smtk::common::TypeContainer& managers);
88  virtual void removeSource(smtk::common::TypeContainer& managers);
89 
90 protected Q_SLOTS:
91  virtual void hoverRow(const QModelIndex& idx);
92  virtual void resetHover();
93 
98  // virtual void editObjectColor(const QModelIndex&);
99 
100 protected:
101  virtual void resetHover(smtk::resource::ComponentSet& add, smtk::resource::ComponentSet& del);
102  bool eventFilter(QObject*, QEvent*) override;
103 
105  class Internal;
106  Internal* m_p;
107  static std::string s_configurationJSON;
108 };
109 } // namespace extension
110 } // namespace smtk
111 #endif // smtk_extension_qtResourceBrowser_h
smtk
The main namespace for the Simulation Modeling Tool Kit (SMTK).
Definition: doc.h:33
PublicPointerDefs.h
smtk::view::SelectionPtr
smtk::shared_ptr< smtk::view::Selection > SelectionPtr
Definition: PublicPointerDefs.h:634
smtk::extension::qtBaseView
A base class for all view types implemented using Qt.
Definition: qtBaseView.h:46
smtk::extension::qtResourceBrowser
A panel that displays SMTK resources available to the application/user.
Definition: qtResourceBrowser.h:51
smtk::view::Information
A class for information passed to views during initialization.
Definition: Information.h:32
smtk::resource::ComponentSet
std::set< smtk::resource::ComponentPtr > ComponentSet
Definition: PublicPointerDefs.h:319
smtk::view::PhraseModelPtr
smtk::shared_ptr< smtk::view::PhraseModel > PhraseModelPtr
Definition: PublicPointerDefs.h:630
smtk::view::SubphraseGeneratorPtr
smtk::shared_ptr< smtk::view::SubphraseGenerator > SubphraseGeneratorPtr
Definition: PublicPointerDefs.h:638
smtk::extension::qtResourceBrowser::getJSONConfiguration
static const std::string & getJSONConfiguration()
Return the string that represents the configuration for browser components.
Definition: qtResourceBrowser.h:79
smtk::extension::qtDescriptivePhraseModel
Adapt an smtk::view::PhraseModel instance into a hierarchical Qt model.
Definition: qtDescriptivePhraseModel.h:40
smtkTypenameMacro
#define smtkTypenameMacro(...)
Add typedefs to a class for identifcation.
Definition: SharedFromThis.h:68
smtk::common::TypeContainer
A container for caching and retrieving instances of types.
Definition: TypeContainer.h:35