1 /***************************************************************************
2 * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef KSTANDARDITEMLISTVIEW_H
21 #define KSTANDARDITEMLISTVIEW_H
23 #include "dolphin_export.h"
25 #include <kitemviews/kitemlistview.h>
28 * @brief Provides layouts for icons-, compact- and details-view.
30 * Together with the KStandardItemModel lists for standard usecases
31 * can be created in a straight forward way.
35 * KStandardItemListView* view = new KStandardItemListView();
36 * KStandardItemModel* model = new KStandardItemModel();
37 * model->appendItem(new KStandardItem("Item 1"));
38 * model->appendItem(new KStandardItem("Item 2"));
39 * KItemListController* controller = new KItemListController(model, view);
40 * KItemListContainer* container = new KItemListContainer(controller, parentWidget);
43 class DOLPHIN_EXPORT KStandardItemListView
: public KItemListView
55 KStandardItemListView(QGraphicsWidget
* parent
= nullptr);
56 ~KStandardItemListView() override
;
58 void setItemLayout(ItemLayout layout
);
59 ItemLayout
itemLayout() const;
62 KItemListWidgetCreatorBase
* defaultWidgetCreator() const override
;
63 KItemListGroupHeaderCreatorBase
* defaultGroupHeaderCreator() const override
;
64 void initializeItemListWidget(KItemListWidget
* item
) override
;
65 bool itemSizeHintUpdateRequired(const QSet
<QByteArray
>& changedRoles
) const override
;
66 virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout
) const;
67 virtual void onItemLayoutChanged(ItemLayout current
, ItemLayout previous
);
68 void onScrollOrientationChanged(Qt::Orientation current
, Qt::Orientation previous
) override
;
69 void onSupportsItemExpandingChanged(bool supportsExpanding
) override
;
70 void polishEvent() override
;
73 void applyDefaultStyleOption(int iconSize
, int padding
, int horizontalMargin
, int verticalMargin
);
74 void updateLayoutOfVisibleItems();
77 ItemLayout m_itemLayout
;