ExtensionManager: Reduce spacing between "cards" from 24px to 16px

Use the dedicated gapSize contant more consistently.

Change-Id: I3d4e27493a758b3bfa1b29988496f53ad0fbd811
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2024-06-26 12:09:36 +02:00
parent 38520cd8a5
commit 3a007ee499

View File

@@ -52,9 +52,9 @@ namespace ExtensionManager::Internal {
Q_LOGGING_CATEGORY(browserLog, "qtc.extensionmanager.browser", QtWarningMsg) Q_LOGGING_CATEGORY(browserLog, "qtc.extensionmanager.browser", QtWarningMsg)
constexpr int gapSize = ExVPaddingGapXl; constexpr int gapSize = HGapL;
constexpr int itemWidth = 330; constexpr int itemWidth = 330;
constexpr int cellWidth = itemWidth + HPaddingL; constexpr int cellWidth = itemWidth + gapSize;
class ExtensionItemDelegate : public QItemDelegate class ExtensionItemDelegate : public QItemDelegate
{ {
@@ -80,25 +80,25 @@ public:
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index)
const override const override
{ {
// +---------------+-------+---------------+----------------------------------------------------------------------+---------------+-----------+ // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+---------+
// | | | | (ExPaddingGapL) | | | // | | | | (ExPaddingGapL) | | |
// | | | +-------------------------------------------------------------+--------+ | | // | | | +-------------------------------------------------------------+--------+ | |
// | | | | <itemName> |<status>| | | // | | | | <itemName> |<status>| | |
// | | | +-------------------------------------------------------------+--------+ | | // | | | +-------------------------------------------------------------+--------+ | |
// | | | | (VGapXxs) | | | // | | | | (VGapXxs) | | |
// | | | +--------+--------+--------------+--------+--------+---------+---------+ | | // | | | +--------+--------+--------------+--------+--------+---------+---------+ | |
// |(ExPaddingGapL)|<icon> |(ExPaddingGapL)|<vendor>|(HGapXs)|<divider>(h16)|(HGapXs)|<dlIcon>|(HGapXxs)|<dlCount>|(ExPaddingGapL)|(HPaddingL)| // |(ExPaddingGapL)|<icon> |(ExPaddingGapL)|<vendor>|(HGapXs)|<divider>(h16)|(HGapXs)|<dlIcon>|(HGapXxs)|<dlCount>|(ExPaddingGapL)|(gapSize)|
// | |(50x50)| +--------+--------+--------------+--------+--------+---------+---------+ | | // | |(50x50)| +--------+--------+--------------+--------+--------+---------+---------+ | |
// | | | | (VGapXxs) | | | // | | | | (VGapXxs) | | |
// | | | +----------------------------------------------------------------------+ | | // | | | +----------------------------------------------------------------------+ | |
// | | | | <tags> | | | // | | | | <tags> | | |
// | | | +----------------------------------------------------------------------+ | | // | | | +----------------------------------------------------------------------+ | |
// | | | | (ExPaddingGapL) | | | // | | | | (ExPaddingGapL) | | |
// +---------------+-------+---------------+----------------------------------------------------------------------+---------------+-----------+ // +---------------+-------+---------------+----------------------------------------------------------------------+---------------+---------+
// | (ExVPaddingGapXl) | // | (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 QRect bgR = bgRGlobal.translated(-option.rect.topLeft());
const int middleColumnW = bgR.width() - ExPaddingGapL - iconBgS.width() - ExPaddingGapL const int middleColumnW = bgR.width() - ExPaddingGapL - iconBgS.width() - ExPaddingGapL
@@ -356,7 +356,9 @@ QSize ExtensionsBrowser::sizeHint() const
int ExtensionsBrowser::extraListViewWidth() const int ExtensionsBrowser::extraListViewWidth() const
{ {
// TODO: Investigate "transient" scrollbar, just for this list view. // TODO: Investigate "transient" scrollbar, just for this list view.
constexpr int extraPadding = qMax(0, ExVPaddingGapXl - gapSize);
return d->extensionsView->style()->pixelMetric(QStyle::PM_ScrollBarExtent) return d->extensionsView->style()->pixelMetric(QStyle::PM_ScrollBarExtent)
+ extraPadding
+ 1; // Needed + 1; // Needed
} }