From 04552f79215af1f842956b8604b17958e080f119 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Fri, 11 Aug 2017 13:09:31 +0800 Subject: [PATCH] Add space between widgets in left side panel. Closes #7224. --- src/gui/categoryfilterwidget.cpp | 7 ++++++- src/gui/tagfilterwidget.cpp | 7 ++++++- src/gui/transferlistfilterswidget.cpp | 12 ++++++------ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/gui/categoryfilterwidget.cpp b/src/gui/categoryfilterwidget.cpp index 5422388b6..7d601d8f5 100644 --- a/src/gui/categoryfilterwidget.cpp +++ b/src/gui/categoryfilterwidget.cpp @@ -168,7 +168,12 @@ void CategoryFilterWidget::callUpdateGeometry() QSize CategoryFilterWidget::sizeHint() const { - return viewportSizeHint(); + return { + // Width should be exactly the width of the content + sizeHintForColumn(0), + // Height should be exactly the height of the content + static_cast(sizeHintForRow(0) * (model()->rowCount() + 0.5)), + }; } QSize CategoryFilterWidget::minimumSizeHint() const diff --git a/src/gui/tagfilterwidget.cpp b/src/gui/tagfilterwidget.cpp index 591d8b427..17efa88b7 100644 --- a/src/gui/tagfilterwidget.cpp +++ b/src/gui/tagfilterwidget.cpp @@ -156,7 +156,12 @@ void TagFilterWidget::callUpdateGeometry() QSize TagFilterWidget::sizeHint() const { - return viewportSizeHint(); + return { + // Width should be exactly the width of the content + sizeHintForColumn(0), + // Height should be exactly the height of the content + static_cast(sizeHintForRow(0) * (model()->rowCount() + 0.5)), + }; } QSize TagFilterWidget::minimumSizeHint() const diff --git a/src/gui/transferlistfilterswidget.cpp b/src/gui/transferlistfilterswidget.cpp index 05188ac41..6f750ad97 100644 --- a/src/gui/transferlistfilterswidget.cpp +++ b/src/gui/transferlistfilterswidget.cpp @@ -89,12 +89,12 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) QSize FiltersBase::sizeHint() const { - QSize size; - // Height should be exactly the height of the content - size.setHeight(((sizeHintForRow(0) + 2 * spacing()) * (count() + 0.5))); - // Width should be exactly the width of the content - size.setWidth(sizeHintForColumn(0)); - return size; + return { + // Width should be exactly the width of the content + sizeHintForColumn(0), + // Height should be exactly the height of the content + static_cast((sizeHintForRow(0) + 2 * spacing()) * (count() + 0.5)), + }; } QSize FiltersBase::minimumSizeHint() const