From 3a007ee499ada33a357d2fcdf9faf2788e772fa2 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 26 Jun 2024 12:09:36 +0200 Subject: [PATCH] ExtensionManager: Reduce spacing between "cards" from 24px to 16px Use the dedicated gapSize contant more consistently. Change-Id: I3d4e27493a758b3bfa1b29988496f53ad0fbd811 Reviewed-by: hjk --- .../extensionmanager/extensionsbrowser.cpp | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/plugins/extensionmanager/extensionsbrowser.cpp b/src/plugins/extensionmanager/extensionsbrowser.cpp index 573c915a69c..a4970d113c3 100644 --- a/src/plugins/extensionmanager/extensionsbrowser.cpp +++ b/src/plugins/extensionmanager/extensionsbrowser.cpp @@ -52,9 +52,9 @@ namespace ExtensionManager::Internal { Q_LOGGING_CATEGORY(browserLog, "qtc.extensionmanager.browser", QtWarningMsg) -constexpr int gapSize = ExVPaddingGapXl; +constexpr int gapSize = HGapL; constexpr int itemWidth = 330; -constexpr int cellWidth = itemWidth + HPaddingL; +constexpr int cellWidth = itemWidth + gapSize; class ExtensionItemDelegate : public QItemDelegate { @@ -80,25 +80,25 @@ public: void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { - // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+-----------+ - // | | | | (ExPaddingGapL) | | | - // | | | +-------------------------------------------------------------+--------+ | | - // | | | | || | | - // | | | +-------------------------------------------------------------+--------+ | | - // | | | | (VGapXxs) | | | - // | | | +--------+--------+--------------+--------+--------+---------+---------+ | | - // |(ExPaddingGapL)| |(ExPaddingGapL)||(HGapXs)|(h16)|(HGapXs)||(HGapXxs)||(ExPaddingGapL)|(HPaddingL)| - // | |(50x50)| +--------+--------+--------------+--------+--------+---------+---------+ | | - // | | | | (VGapXxs) | | | - // | | | +----------------------------------------------------------------------+ | | - // | | | | | | | - // | | | +----------------------------------------------------------------------+ | | - // | | | | (ExPaddingGapL) | | | - // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+-----------+ - // | (ExVPaddingGapXl) | - // +------------------------------------------------------------------------------------------------------------------------------------------+ + // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+---------+ + // | | | | (ExPaddingGapL) | | | + // | | | +-------------------------------------------------------------+--------+ | | + // | | | | || | | + // | | | +-------------------------------------------------------------+--------+ | | + // | | | | (VGapXxs) | | | + // | | | +--------+--------+--------------+--------+--------+---------+---------+ | | + // |(ExPaddingGapL)| |(ExPaddingGapL)||(HGapXs)|(h16)|(HGapXs)||(HGapXxs)||(ExPaddingGapL)|(gapSize)| + // | |(50x50)| +--------+--------+--------------+--------+--------+---------+---------+ | | + // | | | | (VGapXxs) | | | + // | | | +----------------------------------------------------------------------+ | | + // | | | | | | | + // | | | +----------------------------------------------------------------------+ | | + // | | | | (ExPaddingGapL) | | | + // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+---------+ + // | (gapSize) | + // +----------------------------------------------------------------------------------------------------------------------------------------+ - const QRect bgRGlobal = option.rect.adjusted(0, 0, -HPaddingL, -gapSize); + const QRect bgRGlobal = option.rect.adjusted(0, 0, -gapSize, -gapSize); const QRect bgR = bgRGlobal.translated(-option.rect.topLeft()); const int middleColumnW = bgR.width() - ExPaddingGapL - iconBgS.width() - ExPaddingGapL @@ -356,7 +356,9 @@ QSize ExtensionsBrowser::sizeHint() const int ExtensionsBrowser::extraListViewWidth() const { // TODO: Investigate "transient" scrollbar, just for this list view. + constexpr int extraPadding = qMax(0, ExVPaddingGapXl - gapSize); return d->extensionsView->style()->pixelMetric(QStyle::PM_ScrollBarExtent) + + extraPadding + 1; // Needed }