ReselectingTreeView.cpp 833 B

123456789101112131415161718192021222324252627282930
  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. #include <Editor/ReselectingTreeView.h>
  9. #include <QItemSelectionModel>
  10. namespace EMotionFX
  11. {
  12. void ReselectingTreeView::focusInEvent(QFocusEvent* event)
  13. {
  14. emit selectionModel()->selectionChanged({}, {});
  15. QTreeView::focusInEvent(event);
  16. }
  17. void ReselectingTreeView::RecursiveGetAllChildren(const QModelIndex& index, QModelIndexList& outIndicies)
  18. {
  19. outIndicies.push_back(index);
  20. for (int i = 0; i < model()->rowCount(index); ++i)
  21. {
  22. RecursiveGetAllChildren(model()->index(i, 0, index), outIndicies);
  23. }
  24. }
  25. } // namespace EMotionFX