2
* Copyright (C) 2012 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library 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 GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef FM_FOLDERVIEW_P_H
22
#define FM_FOLDERVIEW_P_H
26
#include <QMouseEvent>
27
#include "folderview.h"
33
// override these classes for implementing FolderView
34
class FolderViewListView : public QListView {
37
friend class FolderView;
38
FolderViewListView(QWidget* parent = 0);
39
virtual ~FolderViewListView();
40
virtual void startDrag(Qt::DropActions supportedActions);
41
virtual void mousePressEvent(QMouseEvent* event);
42
virtual void mouseReleaseEvent(QMouseEvent* event);
43
virtual void mouseDoubleClickEvent(QMouseEvent* event);
44
virtual void dragEnterEvent(QDragEnterEvent* event);
45
virtual void dragMoveEvent(QDragMoveEvent* e);
46
virtual void dragLeaveEvent(QDragLeaveEvent* e);
47
virtual void dropEvent(QDropEvent* e);
49
virtual QModelIndex indexAt(const QPoint & point) const;
51
inline void setPositionForIndex(const QPoint & position, const QModelIndex & index) {
52
QListView::setPositionForIndex(position, index);
55
inline QRect rectForIndex(const QModelIndex & index) const {
56
return QListView::rectForIndex(index);
59
inline QStyleOptionViewItem getViewOptions() {
64
void activatedFiltered(const QModelIndex &index);
67
void activation(const QModelIndex &index);
70
bool activationAllowed_;
73
class FolderViewTreeView : public QTreeView {
76
friend class FolderView;
77
FolderViewTreeView(QWidget* parent = 0);
78
virtual ~FolderViewTreeView();
79
virtual void setModel(QAbstractItemModel* model);
80
virtual void mousePressEvent(QMouseEvent* event);
81
virtual void mouseReleaseEvent(QMouseEvent* event);
82
virtual void mouseDoubleClickEvent(QMouseEvent* event);
83
virtual void dragEnterEvent(QDragEnterEvent* event);
84
virtual void dragMoveEvent(QDragMoveEvent* e);
85
virtual void dragLeaveEvent(QDragLeaveEvent* e);
86
virtual void dropEvent(QDropEvent* e);
88
virtual void rowsInserted(const QModelIndex& parent,int start, int end);
89
virtual void rowsAboutToBeRemoved(const QModelIndex& parent,int start, int end);
90
virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
93
virtual void resizeEvent(QResizeEvent* event);
94
void queueLayoutColumns();
97
void activatedFiltered(const QModelIndex &index);
100
void layoutColumns();
101
void activation(const QModelIndex &index);
102
void onSortFilterChanged();
106
QTimer* layoutTimer_;
107
bool activationAllowed_;
113
#endif // FM_FOLDERVIEW_P_H