]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kstandarditemlistview.cpp
Merge branch 'release/20.08' into master
[dolphin.git] / src / kitemviews / kstandarditemlistview.cpp
index 135cd0b7df0102e698cbde8155fb4a19d4206861..bc766a5dcb1e08dd39509b539a2ffb5b7b800d12 100644 (file)
@@ -1,28 +1,14 @@
-/***************************************************************************
- *   Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com>             *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
- ***************************************************************************/
+/*
+ * SPDX-FileCopyrightText: 2012 Peter Penz <peter.penz19@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
 
 #include "kstandarditemlistview.h"
 
-#include <KDebug>
-#include <KIconLoader>
 #include "kstandarditemlistwidget.h"
-#include "kstandarditemlistgroupheader.h"
+
+#include <KIconLoader>
 
 KStandardItemListView::KStandardItemListView(QGraphicsWidget* parent) :
     KItemListView(parent),
@@ -30,7 +16,7 @@ KStandardItemListView::KStandardItemListView(QGraphicsWidget* parent) :
 {
     setAcceptDrops(true);
     setScrollOrientation(Qt::Vertical);
-    setVisibleRoles(QList<QByteArray>() << "text");
+    setVisibleRoles({"text"});
 }
 
 KStandardItemListView::~KStandardItemListView()
@@ -109,21 +95,21 @@ bool KStandardItemListView::itemLayoutSupportsItemExpanding(ItemLayout layout) c
 
 void KStandardItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
     updateLayoutOfVisibleItems();
 }
 
 void KStandardItemListView::onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous)
 {
-    Q_UNUSED(current);
-    Q_UNUSED(previous);
+    Q_UNUSED(current)
+    Q_UNUSED(previous)
     updateLayoutOfVisibleItems();
 }
 
 void KStandardItemListView::onSupportsItemExpandingChanged(bool supportsExpanding)
 {
-    Q_UNUSED(supportsExpanding);
+    Q_UNUSED(supportsExpanding)
     updateLayoutOfVisibleItems();
 }
 
@@ -147,27 +133,20 @@ void KStandardItemListView::applyDefaultStyleOption(int iconSize,
 {
     KItemListStyleOption option = styleOption();
 
-    bool changed = false;
     if (option.iconSize < 0) {
         option.iconSize = iconSize;
-        changed = true;
     }
     if (option.padding < 0) {
         option.padding = padding;
-        changed = true;
     }
     if (option.horizontalMargin < 0) {
         option.horizontalMargin = horizontalMargin;
-        changed = true;
     }
     if (option.verticalMargin < 0) {
         option.verticalMargin = verticalMargin;
-        changed = true;
     }
 
-    if (changed) {
-        setStyleOption(option);
-    }
+    setStyleOption(option);
 }
 
 void KStandardItemListView::updateLayoutOfVisibleItems()
@@ -179,4 +158,3 @@ void KStandardItemListView::updateLayoutOfVisibleItems()
     }
 }
 
-#include "kstandarditemlistview.moc"