]> cloud.milkyroute.net Git - dolphin.git/blob - src/kcategorizedview.h
remove kde4_automoc()
[dolphin.git] / src / kcategorizedview.h
1 /**
2 * This file is part of the KDE project
3 * Copyright (C) 2007 Rafael Fernández López <ereslibre@gmail.com>
4 *
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.
9 *
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.
14 *
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.
19 */
20
21 #ifndef KCATEGORIZEDVIEW_H
22 #define KCATEGORIZEDVIEW_H
23
24 #include <QtGui/QListView>
25
26 #include <libdolphin_export.h>
27
28 class KItemCategorizer;
29
30 /**
31 * @short Item view for listing items
32 *
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.
36 *
37 * @see KItemCategorizer, KSortFilterProxyModel
38 *
39 * @author Rafael Fernández López <ereslibre@gmail.com>
40 */
41 class LIBDOLPHINPRIVATE_EXPORT KCategorizedView
42 : public QListView
43 {
44 Q_OBJECT
45
46 public:
47 KCategorizedView(QWidget *parent = 0);
48
49 ~KCategorizedView();
50
51 virtual void setModel(QAbstractItemModel *model);
52
53 virtual QRect visualRect(const QModelIndex &index) const;
54
55 /**
56 * Will return the current categorizer. If none set, this method will
57 * return 0
58 */
59 KItemCategorizer *itemCategorizer() const;
60
61 /**
62 * Sets the categorizer to be used. Causes the item view to repaint
63 */
64 void setItemCategorizer(KItemCategorizer *itemCategorizer);
65
66 virtual QModelIndex indexAt(const QPoint &point) const;
67
68 public Q_SLOTS:
69 virtual void reset();
70
71 protected:
72 virtual void paintEvent(QPaintEvent *event);
73
74 virtual void resizeEvent(QResizeEvent *event);
75
76 virtual void setSelection(const QRect &rect,
77 QItemSelectionModel::SelectionFlags flags);
78
79 virtual void mouseMoveEvent(QMouseEvent *event);
80
81 virtual void mousePressEvent(QMouseEvent *event);
82
83 virtual void mouseReleaseEvent(QMouseEvent *event);
84
85 virtual void leaveEvent(QEvent *event);
86
87 virtual void startDrag(Qt::DropActions supportedActions);
88
89 virtual void dragMoveEvent(QDragMoveEvent *event);
90
91 virtual void dragLeaveEvent(QDragLeaveEvent *event);
92
93 virtual QModelIndex moveCursor(CursorAction cursorAction,
94 Qt::KeyboardModifiers modifiers);
95
96 protected Q_SLOTS:
97 virtual void rowsInserted(const QModelIndex &parent,
98 int start,
99 int end);
100
101 virtual void rowsInsertedArtifficial(const QModelIndex &parent,
102 int start,
103 int end);
104
105 virtual void rowsRemoved(const QModelIndex &parent,
106 int start,
107 int end);
108
109 virtual void updateGeometries();
110
111 virtual void slotSortingRoleChanged();
112
113
114 private:
115 class Private;
116 Private *d;
117 };
118
119 #endif // KCATEGORIZEDVIEW_H