2
* Copyright 2009 by Marco Martin <notmart@gmail.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU Library General Public License version 2,
7
* or (at your option) any later version.
9
* This program 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
12
* GNU General Public License for more details
14
* You should have received a copy of the GNU Library General Public
15
* License along with this program; if not, write to the
16
* Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include <QGraphicsWidget>
24
#include <QModelIndex>
26
#include <Plasma/ScrollWidget>
28
#include "itemcontainer.h"
38
class ItemView : public Plasma::ScrollWidget
43
enum ScrollBarNeeded {
45
HorizontalScrollBar = 1,
46
VerticalScrollBar = 2,
47
AllScrollBars = HorizontalScrollBar|VerticalScrollBar
49
Q_DECLARE_FLAGS(ScrollBarFlags, ScrollBarNeeded)
51
ItemView(QGraphicsWidget *parent);
54
void setCurrentItem(ResultWidget *currentItem);
55
ResultWidget *currentItem() const;
57
void setOrientation(Qt::Orientation orientation);
58
Qt::Orientation orientation() const;
60
void showSpacer(const QPointF &pos);
62
void setIconSize(int size);
65
QList<ResultWidget *>items() const;
67
void setDragAndDropMode(ItemContainer::DragAndDropMode mode);
68
ItemContainer::DragAndDropMode dragAndDropMode() const;
70
qreal positionToWeight(const QPointF &point);
71
void setModel(QAbstractItemModel *model);
72
QAbstractItemModel *model() const;
73
void setRootIndex(QModelIndex index);
74
QModelIndex rootIndex() const;
75
int rowForPosition(const QPointF &point);
78
void setScrollPositionFromDragPosition(const QPointF &point);
81
void resizeEvent(QGraphicsSceneResizeEvent *event);
82
bool eventFilter(QObject *watched, QEvent *event);
83
void focusInEvent(QFocusEvent *event);
86
void selectItem(ResultWidget *icon);
89
void itemSelected(ResultWidget *);
90
void itemActivated(const QModelIndex &index);
91
void resetRequested();
92
void scrollBarsNeededChanged(ItemView::ScrollBarFlags);
93
void itemAskedReorder(const QModelIndex &index, const QPointF &point);
94
void dragStartRequested(const QModelIndex &index);
95
void addActionTriggered(const QModelIndex &index);
98
ItemContainer *m_itemContainer;
99
QTimer *m_noActivateTimer;