#include <QStyleOptionRubberBand>
#include <QTimer>
+#include "kitemlistviewaccessible.h"
+
namespace {
// Time in ms until reaching the autoscroll margin triggers
// an initial autoscrolling
const int RepeatingAutoScrollDelay = 1000 / 60;
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessibleInterface* accessibleInterfaceFactory(const QString &key, QObject *object)
+{
+ Q_UNUSED(key)
+ if (KItemListContainer*view = qobject_cast<KItemListContainer*>(object)) {
+ return new KItemListContainerAccessible(view);
+ }
+ if (KItemListView *view = qobject_cast<KItemListView*>(object)) {
+ return new KItemListViewAccessible(view);
+ }
+ return 0;
+}
+#endif
+
KItemListView::KItemListView(QGraphicsWidget* parent) :
QGraphicsWidget(parent),
m_enabledSelectionToggles(false),
m_headerWidget->setVisible(false);
m_header = new KItemListHeader(this);
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::installFactory(accessibleInterfaceFactory);
+#endif
+
}
KItemListView::~KItemListView()
}
}
+KItemListViewLayouter* KItemListView::layouter() const
+{
+ return m_layouter;
+}
+
void KItemListView::setItemSize(const QSizeF& size)
{
const QSizeF previousSize = m_itemSize;
if (currentWidget) {
currentWidget->setCurrent(true);
}
+ QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
}
void KItemListView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous)
if (m_itemSize.isEmpty()) {
// The items are not aligned in a grid but either as columns or rows.
- startMovingAnim = !supportsItemExpanding();
+ startMovingAnim = true;
} else {
// When having a grid the moving-animation should only be started, if it is done within
// one row in the vertical scroll-orientation or one column in the horizontal scroll-orientation.
const QPointF mappedPos = widget->mapFromItem(this, pos);
const QRectF rect = itemRect(widget->index());
if (mappedPos.y() >= 0 && mappedPos.y() <= rect.height()) {
+ if (m_model->supportsDropping(widget->index())) {
+ const int gap = qMax(4, m_styleOption.padding);
+ if (mappedPos.y() >= gap && mappedPos.y() <= rect.height() - gap) {
+ return -1;
+ }
+ }
+
const bool isAboveItem = (mappedPos.y () < rect.height() / 2);
const qreal y = isAboveItem ? rect.top() : rect.bottom();