GemRepoListView.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 <GemRepo/GemRepoListView.h>
  9. #include <GemRepo/GemRepoItemDelegate.h>
  10. #include <AdjustableHeaderWidget.h>
  11. #include <QShortcut>
  12. #include <QHeaderView>
  13. namespace O3DE::ProjectManager
  14. {
  15. GemRepoListView::GemRepoListView(
  16. QAbstractItemModel* model, QItemSelectionModel* selectionModel, AdjustableHeaderWidget* header, QWidget* parent)
  17. : QListView(parent)
  18. {
  19. setObjectName("gemRepoListView");
  20. setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
  21. setModel(model);
  22. setSelectionModel(selectionModel);
  23. GemRepoItemDelegate* itemDelegate = new GemRepoItemDelegate(model, header, this);
  24. connect(itemDelegate, &GemRepoItemDelegate::RemoveRepo, this, &GemRepoListView::RemoveRepo);
  25. connect(itemDelegate, &GemRepoItemDelegate::RefreshRepo, this, &GemRepoListView::RefreshRepo);
  26. connect(header, &AdjustableHeaderWidget::sectionsResized, [=] { update(); });
  27. setItemDelegate(itemDelegate);
  28. }
  29. } // namespace O3DE::ProjectManager