2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@kde.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef KCATEGORIZEDVIEW_H
22 #define KCATEGORIZEDVIEW_H
24 #include <QtGui/QListView>
26 #include <libdolphin_export.h>
28 class KCategoryDrawer
;
31 * @short Item view for listing items
33 * KCategorizedView allows you to use it as it were a QListView. You can add an
34 * itemCategorizer to it, so your items became categorized depending on the
35 * KItemCategorizer inherited class rules.
37 * @see KItemCategorizer, KSortFilterProxyModel
39 * @author Rafael Fernández López <ereslibre@kde.org>
41 class LIBDOLPHINPRIVATE_EXPORT KCategorizedView
47 KCategorizedView(QWidget
*parent
= 0);
51 virtual void setModel(QAbstractItemModel
*model
);
53 void setGridSize(const QSize
&size
);
55 virtual QRect
visualRect(const QModelIndex
&index
) const;
57 KCategoryDrawer
*categoryDrawer() const;
59 void setCategoryDrawer(KCategoryDrawer
*categoryDrawer
);
61 virtual QModelIndex
indexAt(const QPoint
&point
) const;
67 virtual void paintEvent(QPaintEvent
*event
);
69 virtual void resizeEvent(QResizeEvent
*event
);
71 virtual void setSelection(const QRect
&rect
,
72 QItemSelectionModel::SelectionFlags flags
);
74 virtual void mouseMoveEvent(QMouseEvent
*event
);
76 virtual void mousePressEvent(QMouseEvent
*event
);
78 virtual void mouseReleaseEvent(QMouseEvent
*event
);
80 virtual void leaveEvent(QEvent
*event
);
82 virtual void startDrag(Qt::DropActions supportedActions
);
84 virtual void dragMoveEvent(QDragMoveEvent
*event
);
86 virtual void dragLeaveEvent(QDragLeaveEvent
*event
);
88 virtual void dropEvent(QDropEvent
*event
);
90 virtual QModelIndex
moveCursor(CursorAction cursorAction
,
91 Qt::KeyboardModifiers modifiers
);
94 virtual void rowsInserted(const QModelIndex
&parent
,
98 virtual void rowsInsertedArtifficial(const QModelIndex
&parent
,
102 virtual void rowsRemoved(const QModelIndex
&parent
,
106 virtual void updateGeometries();
108 virtual void slotLayoutChanged();
110 virtual void currentChanged(const QModelIndex
¤t
,
111 const QModelIndex
&previous
);
119 #endif // KCATEGORIZEDVIEW_H