#include <QSet>
class KItemModelBase;
+class KItemListKeyboardSearchManager;
class KItemListSelectionManager;
class KItemListView;
+class KItemListWidget;
class QGraphicsSceneHoverEvent;
class QGraphicsSceneDragDropEvent;
class QGraphicsSceneMouseEvent;
virtual bool processEvent(QEvent* event, const QTransform& transform);
signals:
- void itemClicked(int index, Qt::MouseButton button);
+ void itemActivated(int index);
+ void itemMiddleClicked(int index);
+
+ /**
+ * Emitted if a context-menu is requested for the item with
+ * the index \a index. It is assured that the index is valid.
+ */
+ void itemContextMenuRequested(int index, const QPointF& pos);
+
+ /**
+ * Emitted if a context-menu is requested for the KItemListView.
+ */
+ void viewContextMenuRequested(const QPointF& pos);
+
+ /**
+ * Emitted if a context-menu is requested for the header of the KItemListView.
+ */
+ void headerContextMenuRequested(const QPointF& pos);
/**
* Is emitted if the item with the index \p index gets hovered.
void itemExpansionToggleClicked(int index);
+ /**
+ * Is emitted if a drop event is done above the item with the index
+ * \a index. If \a index is < 0 the drop event is done above an
+ * empty area of the view.
+ */
+ void itemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
+
void modelChanged(KItemModelBase* current, KItemModelBase* previous);
void viewChanged(KItemListView* current, KItemListView* previous);
private slots:
- void slotViewOffsetChanged(qreal current, qreal previous);
+ void slotViewScrollOffsetChanged(qreal current, qreal previous);
/**
* Is invoked when the rubberband boundaries have been changed and will select
*/
void slotRubberBandChanged();
+ void slotChangeCurrentItem(const QString& text, bool searchFromNextItem);
+
private:
/**
- * Creates a QDrag object to start a drag-operation.
+ * Creates a QDrag object and initiates a drag-operation.
*/
void startDragging();
+ /**
+ * @return Widget that is currently in the hovered state. 0 is returned
+ * if no widget is marked as hovered.
+ */
+ KItemListWidget* hoveredWidget() const;
+
+ /**
+ * @return Widget that is below the position \a pos. 0 is returned
+ * if no widget is below the position.
+ */
+ KItemListWidget* widgetForPos(const QPointF& pos) const;
+
private:
- bool m_dragging;
SelectionBehavior m_selectionBehavior;
KItemModelBase* m_model;
KItemListView* m_view;
KItemListSelectionManager* m_selectionManager;
+ KItemListKeyboardSearchManager* m_keyboardManager;
int m_pressedIndex;
QPointF m_pressedMousePos;