[LYN-2522] Gem catalog header widgets (#919)
* Added header widget with the name based filter * Added column title header together with the the number of currently shown/filtered gemsmain
parent
37813945cf
commit
05f3144055
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzQtComponents/Components/SearchLineEdit.h>
|
||||
#include <GemCatalog/GemCatalogHeaderWidget.h>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemCatalogHeaderWidget::GemCatalogHeaderWidget(GemSortFilterProxyModel* filterProxyModel, QWidget* parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
QHBoxLayout* hLayout = new QHBoxLayout();
|
||||
hLayout->setAlignment(Qt::AlignLeft);
|
||||
hLayout->setMargin(0);
|
||||
setLayout(hLayout);
|
||||
|
||||
setStyleSheet("background-color: #1E252F;");
|
||||
|
||||
QLabel* titleLabel = new QLabel(tr("Gem Catalog"));
|
||||
titleLabel->setStyleSheet("font-size: 21px;");
|
||||
hLayout->addWidget(titleLabel);
|
||||
|
||||
hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
|
||||
|
||||
AzQtComponents::SearchLineEdit* filterLineEdit = new AzQtComponents::SearchLineEdit();
|
||||
filterLineEdit->setStyleSheet("background-color: #DDDDDD;");
|
||||
connect(filterLineEdit, &QLineEdit::textChanged, this, [=](const QString& text)
|
||||
{
|
||||
filterProxyModel->SetSearchString(text);
|
||||
});
|
||||
hLayout->addWidget(filterLineEdit);
|
||||
|
||||
hLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
|
||||
hLayout->addSpacerItem(new QSpacerItem(220, 0, QSizePolicy::Fixed));
|
||||
|
||||
setFixedHeight(60);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <GemCatalog/GemSortFilterProxyModel.h>
|
||||
#include <QFrame>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemCatalogHeaderWidget
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
explicit GemCatalogHeaderWidget(GemSortFilterProxyModel* filterProxyModel, QWidget* parent = nullptr);
|
||||
~GemCatalogHeaderWidget() = default;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,78 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <GemCatalog/GemItemDelegate.h>
|
||||
#include <GemCatalog/GemListHeaderWidget.h>
|
||||
#include <QStandardItemModel>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
GemListHeaderWidget::GemListHeaderWidget(GemSortFilterProxyModel* proxyModel, QWidget* parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
QVBoxLayout* vLayout = new QVBoxLayout();
|
||||
vLayout->setMargin(0);
|
||||
setLayout(vLayout);
|
||||
|
||||
setStyleSheet("background-color: #333333;");
|
||||
|
||||
vLayout->addSpacing(20);
|
||||
|
||||
// Top section
|
||||
QHBoxLayout* topLayout = new QHBoxLayout();
|
||||
topLayout->setMargin(0);
|
||||
topLayout->addSpacerItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
|
||||
|
||||
QLabel* showCountLabel = new QLabel();
|
||||
showCountLabel->setStyleSheet("font-size: 11pt; font: italic;");
|
||||
topLayout->addWidget(showCountLabel);
|
||||
connect(proxyModel, &GemSortFilterProxyModel::OnInvalidated, this, [=]
|
||||
{
|
||||
const int numGemsShown = proxyModel->rowCount();
|
||||
showCountLabel->setText(QString(tr("showing %1 Gems")).arg(numGemsShown));
|
||||
});
|
||||
|
||||
topLayout->addSpacing(GemItemDelegate::s_contentMargins.right() + GemItemDelegate::s_borderWidth);
|
||||
|
||||
vLayout->addLayout(topLayout);
|
||||
|
||||
vLayout->addSpacing(20);
|
||||
|
||||
// Separating line
|
||||
QFrame* hLine = new QFrame();
|
||||
hLine->setFrameShape(QFrame::HLine);
|
||||
hLine->setStyleSheet("color: #666666;");
|
||||
vLayout->addWidget(hLine);
|
||||
|
||||
vLayout->addSpacing(GemItemDelegate::s_contentMargins.top());
|
||||
|
||||
// Bottom section
|
||||
QHBoxLayout* columnHeaderLayout = new QHBoxLayout();
|
||||
columnHeaderLayout->setAlignment(Qt::AlignLeft);
|
||||
|
||||
columnHeaderLayout->addSpacing(31);
|
||||
|
||||
QLabel* gemNameLabel = new QLabel(tr("Gem Name"));
|
||||
gemNameLabel->setStyleSheet("font-size: 11pt;");
|
||||
columnHeaderLayout->addWidget(gemNameLabel);
|
||||
|
||||
columnHeaderLayout->addSpacing(111);
|
||||
|
||||
QLabel* gemSummaryLabel = new QLabel(tr("Gem Summary"));
|
||||
gemSummaryLabel->setStyleSheet("font-size: 11pt;");
|
||||
columnHeaderLayout->addWidget(gemSummaryLabel);
|
||||
|
||||
vLayout->addLayout(columnHeaderLayout);
|
||||
}
|
||||
} // namespace O3DE::ProjectManager
|
||||
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <GemCatalog/GemSortFilterProxyModel.h>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QFrame>
|
||||
#endif
|
||||
|
||||
namespace O3DE::ProjectManager
|
||||
{
|
||||
class GemListHeaderWidget
|
||||
: public QFrame
|
||||
{
|
||||
Q_OBJECT // AUTOMOC
|
||||
|
||||
public:
|
||||
explicit GemListHeaderWidget(GemSortFilterProxyModel* proxyModel, QWidget* parent = nullptr);
|
||||
~GemListHeaderWidget() = default;
|
||||
};
|
||||
} // namespace O3DE::ProjectManager
|
||||
Loading…
Reference in New Issue