diff --git a/extras/imaging/examples/hdui/api.h b/extras/imaging/examples/hdui/api.h new file mode 100644 index 0000000000..8efca4880f --- /dev/null +++ b/extras/imaging/examples/hdui/api.h @@ -0,0 +1,49 @@ +// +// Copyright 2023 Pixar +// +// Licensed under the Apache License, Version 2.0 (the "Apache License") +// with the following modification; you may not use this file except in +// compliance with the Apache License and the following modification to it: +// Section 6. Trademarks. is deleted and replaced with: +// +// 6. Trademarks. This License does not grant permission to use the trade +// names, trademarks, service marks, or product names of the Licensor +// and its affiliates, except as required to comply with Section 4(c) of +// the License and to reproduce the content of the NOTICE file. +// +// You may obtain a copy of the Apache License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the Apache License with the above modification is +// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the Apache License for the specific +// language governing permissions and limitations under the Apache License. +// +#ifndef EXTRAS_IMAGING_EXAMPLES_HDUI_API_H +#define EXTRAS_IMAGING_EXAMPLES_HDUI_API_H + +#include "pxr/base/arch/export.h" + +#if defined(PXR_STATIC) +# define HDUI_API +# define HDUI_API_TEMPLATE_CLASS(...) +# define HDUI_API_TEMPLATE_STRUCT(...) +# define HDUI_LOCAL +#else +# if defined(HDUI_EXPORTS) +# define HDUI_API ARCH_EXPORT +# define HDUI_API_TEMPLATE_CLASS(...) ARCH_EXPORT_TEMPLATE(class, __VA_ARGS__) +# define HDUI_API_TEMPLATE_STRUCT(...) ARCH_EXPORT_TEMPLATE(struct, __VA_ARGS__) +# else +# define HDUI_API ARCH_IMPORT +# define HDUI_API_TEMPLATE_CLASS(...) ARCH_IMPORT_TEMPLATE(class, __VA_ARGS__) +# define HDUI_API_TEMPLATE_STRUCT(...) ARCH_IMPORT_TEMPLATE(struct, __VA_ARGS__) +# endif +# define HDUI_LOCAL ARCH_HIDDEN +#endif + +#define HDUI_API_CLASS HDUI_API + +#endif // EXTRAS_IMAGING_EXAMPLES_HDUI_API_H diff --git a/extras/imaging/examples/hdui/dataSourceTreeWidget.h b/extras/imaging/examples/hdui/dataSourceTreeWidget.h index 69c18563a0..0d429a9ecb 100644 --- a/extras/imaging/examples/hdui/dataSourceTreeWidget.h +++ b/extras/imaging/examples/hdui/dataSourceTreeWidget.h @@ -24,13 +24,15 @@ #ifndef PXR_IMAGING_HDUI_DATA_SOURCE_TREE_WIDGET_H #define PXR_IMAGING_HDUI_DATA_SOURCE_TREE_WIDGET_H +#include "api.h" + #include "pxr/imaging/hd/sceneIndex.h" #include PXR_NAMESPACE_OPEN_SCOPE -class HduiDataSourceTreeWidget : public QTreeWidget +class HDUI_API_CLASS HduiDataSourceTreeWidget : public QTreeWidget { Q_OBJECT; diff --git a/extras/imaging/examples/hdui/dataSourceValueTreeView.cpp b/extras/imaging/examples/hdui/dataSourceValueTreeView.cpp index f33de26275..cf54465858 100644 --- a/extras/imaging/examples/hdui/dataSourceValueTreeView.cpp +++ b/extras/imaging/examples/hdui/dataSourceValueTreeView.cpp @@ -26,6 +26,7 @@ #include #include +#include #include @@ -56,7 +57,8 @@ class Hdui_ValueItemModel : public QAbstractItemModel if (index.column() == 0) { std::ostringstream buffer; buffer << _value; - return QVariant(buffer.str().data()); + std::string str = buffer.str(); + return QVariant(QString::fromUtf8(str.data(), str.size())); } } @@ -141,7 +143,8 @@ class Hdui_TypedArrayValueItemModel : public Hdui_ValueItemModel if (index.row() < static_cast(_array.size())) { std::ostringstream buffer; buffer << _array.cdata()[index.row()]; - return QVariant(buffer.str().data()); + std::string str = buffer.str(); + return QVariant(QString::fromUtf8(str.data(), str.size())); } } @@ -154,7 +157,8 @@ class Hdui_TypedArrayValueItemModel : public Hdui_ValueItemModel if (section == 1) { std::ostringstream buffer; buffer << _array.size() << " values"; - return QVariant(buffer.str().c_str()); + std::string str = buffer.str(); + return QVariant(QString::fromUtf8(str.data(), str.size())); } } diff --git a/extras/imaging/examples/hdui/dataSourceValueTreeView.h b/extras/imaging/examples/hdui/dataSourceValueTreeView.h index 28fe4d72ad..45f3c0d6a7 100644 --- a/extras/imaging/examples/hdui/dataSourceValueTreeView.h +++ b/extras/imaging/examples/hdui/dataSourceValueTreeView.h @@ -24,13 +24,15 @@ #ifndef PXR_IMAGING_HDUI_DATA_SOURCE_VALUE_TREE_VIEW_H #define PXR_IMAGING_HDUI_DATA_SOURCE_VALUE_TREE_VIEW_H +#include "api.h" + #include "pxr/imaging/hd/dataSource.h" #include PXR_NAMESPACE_OPEN_SCOPE -class HduiDataSourceValueTreeView : public QTreeView +class HDUI_API_CLASS HduiDataSourceValueTreeView : public QTreeView { Q_OBJECT; public: diff --git a/extras/imaging/examples/hdui/registeredSceneIndexChooser.h b/extras/imaging/examples/hdui/registeredSceneIndexChooser.h index 6a4cf90fcd..86dd4ccdd6 100644 --- a/extras/imaging/examples/hdui/registeredSceneIndexChooser.h +++ b/extras/imaging/examples/hdui/registeredSceneIndexChooser.h @@ -24,6 +24,8 @@ #ifndef PXR_IMAGING_HDUI_REGISTERED_SCENE_INDEX_CHOOSER_H #define PXR_IMAGING_HDUI_REGISTERED_SCENE_INDEX_CHOOSER_H +#include "api.h" + #include "pxr/imaging/hd/sceneIndex.h" #include @@ -31,7 +33,7 @@ PXR_NAMESPACE_OPEN_SCOPE -class HduiRegisteredSceneIndexChooser : public QPushButton +class HDUI_API_CLASS HduiRegisteredSceneIndexChooser : public QPushButton { Q_OBJECT; public: diff --git a/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.cpp b/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.cpp index 2a01a10a90..8c2e367c4b 100644 --- a/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.cpp +++ b/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.cpp @@ -198,7 +198,7 @@ HduiSceneIndexDebuggerWidget::_FillGoToInputMenu() }); QObject::connect(menuTreeWidget, &QTreeWidget::itemClicked, - [this, menu, menuTreeWidget](QTreeWidgetItem *item, int column) { + [this, menu](QTreeWidgetItem *item, int column) { if (_InputSelectionItem *selectionItem = dynamic_cast<_InputSelectionItem*>(item)) { diff --git a/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.h b/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.h index cd3de3fe70..069900eae3 100644 --- a/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.h +++ b/extras/imaging/examples/hdui/sceneIndexDebuggerWidget.h @@ -24,6 +24,8 @@ #ifndef PXR_IMAGING_HDUI_SCENE_INDEX_DEBUGGING_WIDGET_H #define PXR_IMAGING_HDUI_SCENE_INDEX_DEBUGGING_WIDGET_H +#include "api.h" + #include "pxr/imaging/hd/sceneIndex.h" #include @@ -38,7 +40,7 @@ class HduiDataSourceTreeWidget; class HduiDataSourceValueTreeView; class HduiRegisteredSceneIndexChooser; -class HduiSceneIndexDebuggerWidget : public QWidget, public TfWeakBase +class HDUI_API_CLASS HduiSceneIndexDebuggerWidget : public QWidget, public TfWeakBase { Q_OBJECT; public: diff --git a/extras/imaging/examples/hdui/sceneIndexObserverLoggingTreeView.h b/extras/imaging/examples/hdui/sceneIndexObserverLoggingTreeView.h index ee93f3157a..e57f5814aa 100644 --- a/extras/imaging/examples/hdui/sceneIndexObserverLoggingTreeView.h +++ b/extras/imaging/examples/hdui/sceneIndexObserverLoggingTreeView.h @@ -24,13 +24,15 @@ #ifndef PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_TREE_VIEW_H #define PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_TREE_VIEW_H +#include "api.h" + #include "pxr/imaging/hd/sceneIndex.h" #include PXR_NAMESPACE_OPEN_SCOPE -class HduiSceneIndexObserverLoggingTreeView : public QTreeView +class HDUI_API_CLASS HduiSceneIndexObserverLoggingTreeView : public QTreeView { Q_OBJECT; public: @@ -50,7 +52,7 @@ public Q_SLOTS: private: - class _ObserverModel : + class HDUI_API_CLASS _ObserverModel : public HdSceneIndexObserver, public QAbstractItemModel { public: diff --git a/extras/imaging/examples/hdui/sceneIndexObserverLoggingWidget.h b/extras/imaging/examples/hdui/sceneIndexObserverLoggingWidget.h index 78a957b6e2..e2236d750d 100644 --- a/extras/imaging/examples/hdui/sceneIndexObserverLoggingWidget.h +++ b/extras/imaging/examples/hdui/sceneIndexObserverLoggingWidget.h @@ -24,6 +24,8 @@ #ifndef PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_WIDGET_H #define PXR_IMAGING_HDUI_SCENE_INDEX_OBSERVER_LOGGING_WIDGET_H +#include "api.h" + #include "pxr/pxr.h" #include @@ -33,7 +35,7 @@ PXR_NAMESPACE_OPEN_SCOPE class HduiSceneIndexObserverLoggingTreeView; -class HduiSceneIndexObserverLoggingWidget : public QWidget +class HDUI_API_CLASS HduiSceneIndexObserverLoggingWidget : public QWidget { Q_OBJECT; public: diff --git a/extras/imaging/examples/hdui/sceneIndexTreeWidget.h b/extras/imaging/examples/hdui/sceneIndexTreeWidget.h index 6653c1024a..8a275ddc61 100644 --- a/extras/imaging/examples/hdui/sceneIndexTreeWidget.h +++ b/extras/imaging/examples/hdui/sceneIndexTreeWidget.h @@ -24,6 +24,7 @@ #ifndef PXR_IMAGING_HDUI_SCENE_INDEX_TREE_WIDGET_H #define PXR_IMAGING_HDUI_SCENE_INDEX_TREE_WIDGET_H +#include "api.h" #include "pxr/imaging/hd/sceneIndex.h" @@ -36,7 +37,7 @@ class Hdui_SceneIndexPrimTreeWidgetItem; //----------------------------------------------------------------------------- -class HduiSceneIndexTreeWidget : public QTreeWidget, public HdSceneIndexObserver +class HDUI_API_CLASS HduiSceneIndexTreeWidget : public QTreeWidget, public HdSceneIndexObserver { Q_OBJECT; public: