Resizable Headers for Gem Catalog and Gem Repo Screen (#6885)
* Initial mostly working attempt at resizable headers Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Add const and constexpr to variables Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Add header tracking for buttons, display items based on header scrollbar position, fix some spacing issues Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Correct styling for adjustable header, and intending header section and alingned item content with header text Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Prevent header resizing larger than table width. Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com> * Fix resize graphical glitching Signed-off-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com> * Remove unecessary qss Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Removed necessary headers Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Remove extra nl and old comment Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Address PR feedback Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Removed unused variables Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Change variable to constexpr Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Remove AUTOMOC from headers, set background color of Gem Catalog to 333333 and adjustable header to transparent Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Change to using update instead of repaint when sections are resized Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> * Change temp directory creation on for gradle Signed-off-by: nggieber <52797929+AMZN-nggieber@users.noreply.github.com> Co-authored-by: Alex Peterson <26804013+AMZN-alexpete@users.noreply.github.com>
This commit is contained in:
@@ -19,8 +19,10 @@
|
||||
#include <GemCatalog/GemDependenciesDialog.h>
|
||||
#include <GemCatalog/GemUpdateDialog.h>
|
||||
#include <GemCatalog/GemUninstallDialog.h>
|
||||
#include <GemCatalog/GemItemDelegate.h>
|
||||
#include <DownloadController.h>
|
||||
#include <ProjectUtils.h>
|
||||
#include <AdjustableHeaderWidget.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
@@ -40,6 +42,13 @@ namespace O3DE::ProjectManager
|
||||
GemCatalogScreen::GemCatalogScreen(QWidget* parent)
|
||||
: ScreenWidget(parent)
|
||||
{
|
||||
// The width of either side panel (filters, inspector) in the catalog
|
||||
constexpr int sidePanelWidth = 240;
|
||||
// Querying qApp about styling reports the scroll bar being larger than it is so define it manually
|
||||
constexpr int verticalScrollBarWidth = 8;
|
||||
|
||||
setObjectName("GemCatalogScreen");
|
||||
|
||||
m_gemModel = new GemModel(this);
|
||||
m_proxyModel = new GemSortFilterProxyModel(m_gemModel, this);
|
||||
|
||||
@@ -69,10 +78,8 @@ namespace O3DE::ProjectManager
|
||||
hLayout->setMargin(0);
|
||||
vLayout->addLayout(hLayout);
|
||||
|
||||
m_gemListView = new GemListView(m_proxyModel, m_proxyModel->GetSelectionModel(), this);
|
||||
|
||||
m_rightPanelStack = new QStackedWidget(this);
|
||||
m_rightPanelStack->setFixedWidth(240);
|
||||
m_rightPanelStack->setFixedWidth(sidePanelWidth);
|
||||
|
||||
m_gemInspector = new GemInspector(m_gemModel, this);
|
||||
|
||||
@@ -81,18 +88,45 @@ namespace O3DE::ProjectManager
|
||||
connect(m_gemInspector, &GemInspector::UninstallGem, this, &GemCatalogScreen::UninstallGem);
|
||||
|
||||
QWidget* filterWidget = new QWidget(this);
|
||||
filterWidget->setFixedWidth(240);
|
||||
filterWidget->setFixedWidth(sidePanelWidth);
|
||||
m_filterWidgetLayout = new QVBoxLayout();
|
||||
m_filterWidgetLayout->setMargin(0);
|
||||
m_filterWidgetLayout->setSpacing(0);
|
||||
filterWidget->setLayout(m_filterWidgetLayout);
|
||||
|
||||
GemListHeaderWidget* listHeaderWidget = new GemListHeaderWidget(m_proxyModel);
|
||||
GemListHeaderWidget* catalogHeaderWidget = new GemListHeaderWidget(m_proxyModel);
|
||||
|
||||
constexpr int minHeaderSectionWidth = 100;
|
||||
AdjustableHeaderWidget* listHeaderWidget = new AdjustableHeaderWidget(
|
||||
QStringList{ tr("Gem Name"), tr("Gem Summary"), tr("Status") },
|
||||
QVector<int>{
|
||||
GemItemDelegate::s_defaultSummaryStartX - 30,
|
||||
0, // Section is set to stretch to fit
|
||||
GemItemDelegate::s_buttonWidth + GemItemDelegate::s_itemMargins.left() + GemItemDelegate::s_itemMargins.right() + GemItemDelegate::s_contentMargins.right()
|
||||
},
|
||||
minHeaderSectionWidth,
|
||||
QVector<QHeaderView::ResizeMode>
|
||||
{
|
||||
QHeaderView::ResizeMode::Interactive,
|
||||
QHeaderView::ResizeMode::Stretch,
|
||||
QHeaderView::ResizeMode::Fixed
|
||||
},
|
||||
this);
|
||||
|
||||
m_gemListView = new GemListView(m_proxyModel, m_proxyModel->GetSelectionModel(), listHeaderWidget, this);
|
||||
|
||||
QHBoxLayout* listHeaderLayout = new QHBoxLayout();
|
||||
listHeaderLayout->setMargin(0);
|
||||
listHeaderLayout->setSpacing(0);
|
||||
listHeaderLayout->addSpacing(GemItemDelegate::s_itemMargins.left());
|
||||
listHeaderLayout->addWidget(listHeaderWidget);
|
||||
listHeaderLayout->addSpacing(GemItemDelegate::s_itemMargins.right() + verticalScrollBarWidth);
|
||||
|
||||
QVBoxLayout* middleVLayout = new QVBoxLayout();
|
||||
middleVLayout->setMargin(0);
|
||||
middleVLayout->setSpacing(0);
|
||||
middleVLayout->addWidget(listHeaderWidget);
|
||||
middleVLayout->addWidget(catalogHeaderWidget);
|
||||
middleVLayout->addLayout(listHeaderLayout);
|
||||
middleVLayout->addWidget(m_gemListView);
|
||||
|
||||
hLayout->addWidget(filterWidget);
|
||||
|
||||
Reference in New Issue
Block a user