BuilderListModel.h 1021 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 <QAbstractListModel>
  11. #include <QSortFilterProxyModel>
  12. #endif
  13. namespace AZ
  14. {
  15. struct Uuid;
  16. }
  17. struct BuilderListModel : QAbstractListModel
  18. {
  19. Q_OBJECT;
  20. public:
  21. BuilderListModel(QObject* parent = nullptr)
  22. : QAbstractListModel(parent)
  23. {
  24. }
  25. int rowCount(const QModelIndex& parent) const override;
  26. QVariant data(const QModelIndex& index, int role) const override;
  27. QModelIndex GetIndexForBuilder(const AZ::Uuid& builderUuid);
  28. void Reset();
  29. };
  30. struct BuilderListSortFilterProxy : QSortFilterProxyModel
  31. {
  32. BuilderListSortFilterProxy(QObject* parent)
  33. : QSortFilterProxyModel(parent)
  34. {}
  35. protected:
  36. bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const override;
  37. };