GemRequirementDelegate.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 <GemCatalog/GemItemDelegate.h>
  11. #endif
  12. namespace O3DE::ProjectManager
  13. {
  14. class GemRequirementDelegate
  15. : public GemItemDelegate
  16. {
  17. Q_OBJECT
  18. public:
  19. explicit GemRequirementDelegate(QAbstractItemModel* model, QObject* parent = nullptr);
  20. ~GemRequirementDelegate() = default;
  21. void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) const override;
  22. bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& modelIndex) override;
  23. const QColor m_backgroundColor = QColor("#444444"); // Outside of the actual gem item
  24. const QColor m_itemBackgroundColor = QColor("#393939"); // Background color of the gem item
  25. private:
  26. QRect CalcRequirementRect(const QRect& contentRect) const;
  27. };
  28. } // namespace O3DE::ProjectManager