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
This commit is contained in:
Harald Sitter 2021-04-19 12:39:00 +02:00
parent 61b2e2fd5e
commit 56888a567f

View file

@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2012 Frank Reininghaus <frank78ac@googlemail.com>
* SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
*
* 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);
}
}