2 * Copyright © 2008 Fredrik Höglund <fredrik@kde.org>
3 * Copyright © 2008 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.
24 #include "abstractitemview.h"
26 #include <QAbstractItemDelegate>
30 #include <QBasicTimer>
35 class KFileItemDelegate
;
36 class KFilePreviewGenerator
;
38 class QItemSelectionModel
;
40 class QStyleOptionViewItemV4
;
44 class ListView
: public AbstractItemView
49 ListView(QGraphicsWidget
*parent
= 0);
52 void setModel(QAbstractItemModel
*model
);
54 void setIconSize(const QSize
&gridSize
);
56 void setWordWrap(bool on
);
57 bool wordWrap() const;
59 void setDrawShadows(bool on
);
60 bool drawShadows() const;
62 QModelIndex
indexAt(const QPointF
&point
) const;
63 QRect
visualRect(const QModelIndex
&index
) const;
66 void startDrag(const QPointF
&pos
, QWidget
*widget
);
67 void updateTextShadows(const QColor
&textColor
);
68 void updateScrollBar();
69 void updateSizeHint();
70 QStyleOptionViewItemV4
viewOptions() const;
72 void paint(QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
= 0);
74 void hoverEnterEvent(QGraphicsSceneHoverEvent
*event
);
75 void hoverMoveEvent(QGraphicsSceneHoverEvent
*event
);
76 void hoverLeaveEvent(QGraphicsSceneHoverEvent
*event
);
77 void mousePressEvent(QGraphicsSceneMouseEvent
*event
);
78 void mouseReleaseEvent(QGraphicsSceneMouseEvent
*event
);
79 void mouseMoveEvent(QGraphicsSceneMouseEvent
*event
);
80 void wheelEvent(QGraphicsSceneWheelEvent
*event
);
81 void contextMenuEvent(QGraphicsSceneContextMenuEvent
*event
);
82 void dropEvent(QGraphicsSceneDragDropEvent
*event
);
83 void resizeEvent(QGraphicsSceneResizeEvent
*event
);
85 void rowsInserted(const QModelIndex
&parent
, int first
, int last
);
86 void rowsRemoved(const QModelIndex
&parent
, int first
, int last
);
89 void dataChanged(const QModelIndex
&topLeft
, const QModelIndex
&bottomRight
);
93 QPersistentModelIndex m_pressedIndex
;
94 bool m_dragInProgress
;