#include "kitemlistview.h"
#include <KDebug>
+#include "kitemlistcontainer.h"
#include "kitemlistcontroller.h"
#include "kitemlistheader.h"
#include "kitemlistselectionmanager.h"
#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* container = qobject_cast<KItemListContainer*>(object)) {
+ return new KItemListContainerAccessible(container);
+ } else 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()
}
}
+qreal KItemListView::verticalPageStep() const
+{
+ qreal headerHeight = 0;
+ if (m_headerWidget->isVisible()) {
+ headerHeight = m_headerWidget->size().height();
+ }
+ return size().height() - headerHeight;
+}
+
int KItemListView::itemAt(const QPointF& pos) const
{
QHashIterator<int, KItemListWidget*> it(m_visibleItems);
doLayout(NoAnimation);
}
}
+ QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
}
void KItemListView::slotGroupedSortingChanged(bool current)
if (currentWidget) {
currentWidget->setCurrent(true);
}
+ QAccessible::updateAccessibility(this, current+1, QAccessible::Focus);
}
void KItemListView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous)
const qreal newScrollOffset = qMin(scrollOffset() + m_autoScrollIncrement, maxVisibleOffset);
setScrollOffset(newScrollOffset);
- // Trigger the autoscroll timer which will periodically call
- // triggerAutoScrolling()
- m_autoScrollTimer->start(RepeatingAutoScrollDelay);
+ // Trigger the autoscroll timer which will periodically call
+ // triggerAutoScrolling()
+ m_autoScrollTimer->start(RepeatingAutoScrollDelay);
}
void KItemListView::slotGeometryOfGroupHeaderParentChanged()