JointSelectionWidget.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <AzQtComponents/Components/FilteredSearchWidget.h>
  11. #include <Editor/SkeletonModel.h>
  12. #include <Editor/SelectionProxyModel.h>
  13. #include <Editor/SkeletonSortFilterProxyModel.h>
  14. #include <QAbstractItemView>
  15. #include <QWidget>
  16. #endif
  17. QT_FORWARD_DECLARE_CLASS(QLabel)
  18. namespace EMotionFX
  19. {
  20. class JointSelectionWidget
  21. : public QWidget
  22. {
  23. Q_OBJECT // AUTOMOC
  24. public:
  25. JointSelectionWidget(QAbstractItemView::SelectionMode selectionMode, QWidget* parent);
  26. ~JointSelectionWidget();
  27. void SelectByJointName(const AZStd::string& jointName, bool clearSelection = true);
  28. void SelectByJointNames(const AZStd::vector<AZStd::string>& jointNames, bool clearSelection = true);
  29. AZStd::vector<AZStd::string> GetSelectedJointNames() const;
  30. void SetFilterState(const QString& category, const QString& displayName, bool enabled);
  31. void HideIcons();
  32. signals:
  33. void ItemDoubleClicked(const QModelIndex& modelIndex);
  34. public slots:
  35. void Reinit();
  36. private slots:
  37. // QTreeView
  38. void OnItemDoubleClicked(const QModelIndex& modelIndex) { emit ItemDoubleClicked(modelIndex); }
  39. // AzQtComponents::FilteredSearchWidget
  40. void OnTextFilterChanged(const QString& text);
  41. void OnTypeFilterChanged(const AzQtComponents::SearchTypeFilterList& activeTypeFilters);
  42. private:
  43. AzQtComponents::FilteredSearchWidget* m_searchWidget;
  44. QTreeView* m_treeView;
  45. AZStd::unique_ptr<SkeletonModel> m_skeletonModel;
  46. SkeletonSortFilterProxyModel* m_filterProxyModel;
  47. QLabel* m_noSelectionLabel;
  48. };
  49. } // namespace EMotionFX