diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp index 5d65c740af..77b0e2b7d2 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.cpp @@ -439,4 +439,9 @@ namespace O3DE::ProjectManager { m_filterLineEdit->setText({}); } + + void GemCatalogHeaderWidget::SetSearchFilter(const QString& filter) + { + m_filterLineEdit->setText(filter); + } } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h index 4d17259840..66bd617fc4 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogHeaderWidget.h @@ -86,6 +86,9 @@ namespace O3DE::ProjectManager void ReinitForProject(); + public slots: + void SetSearchFilter(const QString& filter); + signals: void AddGem(); void OpenGemsRepo(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp index a22f41d054..deea46b582 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp @@ -54,6 +54,8 @@ namespace O3DE::ProjectManager m_gemInspector = new GemInspector(m_gemModel, this); m_gemInspector->setFixedWidth(240); + connect(m_gemInspector, &GemInspector::TagClicked, m_headerWidget, &GemCatalogHeaderWidget::SetSearchFilter); + QWidget* filterWidget = new QWidget(this); filterWidget->setFixedWidth(240); m_filterWidgetLayout = new QVBoxLayout(); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.cpp index 7630e92e88..3d9a8f6c86 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.cpp @@ -175,6 +175,7 @@ namespace O3DE::ProjectManager // Depending gems m_dependingGems = new GemsSubWidget(); + connect(m_dependingGems, &GemsSubWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); }); m_mainLayout->addWidget(m_dependingGems); m_mainLayout->addSpacing(20); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.h index ca36cef240..38285577fd 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemInspector.h @@ -40,6 +40,9 @@ namespace O3DE::ProjectManager inline constexpr static const char* s_headerColor = "#FFFFFF"; inline constexpr static const char* s_textColor = "#DDDDDD"; + signals: + void TagClicked(const QString& tag); + private slots: void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); diff --git a/Code/Tools/ProjectManager/Source/GemsSubWidget.cpp b/Code/Tools/ProjectManager/Source/GemsSubWidget.cpp index eb24008eb1..8b7b183008 100644 --- a/Code/Tools/ProjectManager/Source/GemsSubWidget.cpp +++ b/Code/Tools/ProjectManager/Source/GemsSubWidget.cpp @@ -33,6 +33,7 @@ namespace O3DE::ProjectManager m_layout->addWidget(m_textLabel); m_tagWidget = new TagContainerWidget(); + connect(m_tagWidget, &TagContainerWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); }); m_layout->addWidget(m_tagWidget); } diff --git a/Code/Tools/ProjectManager/Source/GemsSubWidget.h b/Code/Tools/ProjectManager/Source/GemsSubWidget.h index 1b10ec8861..a9fabf5e92 100644 --- a/Code/Tools/ProjectManager/Source/GemsSubWidget.h +++ b/Code/Tools/ProjectManager/Source/GemsSubWidget.h @@ -22,10 +22,15 @@ namespace O3DE::ProjectManager class GemsSubWidget : public QWidget { + Q_OBJECT // AUTOMOC + public: GemsSubWidget(QWidget* parent = nullptr); void Update(const QString& title, const QString& text, const QStringList& gemNames); + signals: + void TagClicked(const QString& tag); + private: QLabel* m_titleLabel = nullptr; QLabel* m_textLabel = nullptr; diff --git a/Code/Tools/ProjectManager/Source/TagWidget.cpp b/Code/Tools/ProjectManager/Source/TagWidget.cpp index ace9d72d8f..39231ace4b 100644 --- a/Code/Tools/ProjectManager/Source/TagWidget.cpp +++ b/Code/Tools/ProjectManager/Source/TagWidget.cpp @@ -18,6 +18,11 @@ namespace O3DE::ProjectManager setObjectName("TagWidget"); } + void TagWidget::mousePressEvent([[maybe_unused]] QMouseEvent* event) + { + emit(TagClicked(text())); + } + TagContainerWidget::TagContainerWidget(QWidget* parent) : QWidget(parent) { @@ -45,7 +50,9 @@ namespace O3DE::ProjectManager foreach (const QString& tag, tags) { - flowLayout->addWidget(new TagWidget(tag)); + TagWidget* tagWidget = new TagWidget(tag); + connect(tagWidget, &TagWidget::TagClicked, this, [=](const QString& tag){ emit TagClicked(tag); }); + flowLayout->addWidget(tagWidget); } } } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/TagWidget.h b/Code/Tools/ProjectManager/Source/TagWidget.h index 0dad7468eb..4cda01b347 100644 --- a/Code/Tools/ProjectManager/Source/TagWidget.h +++ b/Code/Tools/ProjectManager/Source/TagWidget.h @@ -25,6 +25,12 @@ namespace O3DE::ProjectManager public: explicit TagWidget(const QString& text, QWidget* parent = nullptr); ~TagWidget() = default; + + signals: + void TagClicked(const QString& tag); + + protected: + void mousePressEvent(QMouseEvent* event) override; }; // Widget containing multiple tags, automatically wrapping based on the size @@ -38,5 +44,8 @@ namespace O3DE::ProjectManager ~TagContainerWidget() = default; void Update(const QStringList& tags); + + signals: + void TagClicked(const QString& tag); }; } // namespace O3DE::ProjectManager