From 56888a567fc741713b6c905aeed3842a7fa230c7 Mon Sep 17 00:00:00 2001 From: Harald Sitter Date: Mon, 19 Apr 2021 12:39:00 +0200 Subject: [PATCH] fix padding in places view padding was only applied when the icon size was applied, the icon size however is only applied when the user had set an explicit size. this resulted in inconsistent spacing. by default no padding would be used if the user had changed the icon size to medium and back to small it would suddenly have padding. to fix this, set padding unconditionally on construction and never touch it again . BUG: 435731 --- src/panels/places/placesview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp index 9602fb8ac..5214f47dc 100644 --- a/src/panels/places/placesview.cpp +++ b/src/panels/places/placesview.cpp @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2012 Frank Reininghaus + * SPDX-FileCopyrightText: 2021 Harald Sitter * * SPDX-License-Identifier: GPL-2.0-or-later */ @@ -11,6 +12,10 @@ PlacesView::PlacesView(QGraphicsWidget* parent) : KStandardItemListView(parent) { + KItemListStyleOption option = styleOption(); + option.padding = 4; + setStyleOption(option); + const int iconSize = PlacesPanelSettings::iconSize(); if (iconSize >= 0) { setIconSize(iconSize); @@ -26,7 +31,6 @@ void PlacesView::setIconSize(int size) KItemListStyleOption option = styleOption(); option.iconSize = size; - option.padding = 4; setStyleOption(option); } }