2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@gmail.com>
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 KItemCategorizer
;
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@gmail.com>
41 class LIBDOLPHINPRIVATE_EXPORT KCategorizedView
47 KCategorizedView(QWidget
*parent
= 0);
51 virtual void setModel(QAbstractItemModel
*model
);
53 virtual QRect
visualRect(const QModelIndex
&index
) const;
56 * Will return the current categorizer. If none set, this method will
59 KItemCategorizer
*itemCategorizer() const;
62 * Sets the categorizer to be used. Causes the item view to repaint
64 void setItemCategorizer(KItemCategorizer
*itemCategorizer
);
66 virtual QModelIndex
indexAt(const QPoint
&point
) const;
72 virtual void paintEvent(QPaintEvent
*event
);
74 virtual void resizeEvent(QResizeEvent
*event
);
76 virtual void setSelection(const QRect
&rect
,
77 QItemSelectionModel::SelectionFlags flags
);
79 virtual void mouseMoveEvent(QMouseEvent
*event
);
81 virtual void mousePressEvent(QMouseEvent
*event
);
83 virtual void mouseReleaseEvent(QMouseEvent
*event
);
85 virtual void leaveEvent(QEvent
*event
);
87 virtual void startDrag(Qt::DropActions supportedActions
);
89 virtual void dragMoveEvent(QDragMoveEvent
*event
);
91 virtual void dragLeaveEvent(QDragLeaveEvent
*event
);
93 virtual QModelIndex
moveCursor(CursorAction cursorAction
,
94 Qt::KeyboardModifiers modifiers
);
97 virtual void rowsInserted(const QModelIndex
&parent
,
101 virtual void rowsInsertedArtifficial(const QModelIndex
&parent
,
105 virtual void rowsRemoved(const QModelIndex
&parent
,
109 virtual void updateGeometries();
111 virtual void slotSortingRoleChanged();
119 #endif // KCATEGORIZEDVIEW_H