QAccessibleQuickItem::QAccessibleQuickItem(QQuickItem *item)
: QDeclarativeAccessible(item)
- , m_item(item)
{
}
{
// ### no canvas in some cases.
// ### Should we really check for 0 opacity?
- if (!m_item->canvas() ||!m_item->isVisible() || qFuzzyIsNull(m_item->opacity())) {
+ if (!item()->canvas() ||!item()->isVisible() || qFuzzyIsNull(item()->opacity())) {
return QRect();
}
- QSizeF size = QSizeF(m_item->width(), m_item->height());
+ QSizeF size = QSizeF(item()->width(), item()->height());
// ### If the bounding rect fails, we first try the implicit size, then we go for the
// parent size. WE MIGHT HAVE TO REVISIT THESE FALLBACKS.
if (size.isEmpty()) {
- size = QSizeF(m_item->implicitWidth(), m_item->implicitHeight());
+ size = QSizeF(item()->implicitWidth(), item()->implicitHeight());
if (size.isEmpty())
// ### Seems that the above fallback is not enough, fallback to use the parent size...
- size = QSizeF(m_item->parentItem()->width(), m_item->parentItem()->height());
+ size = QSizeF(item()->parentItem()->width(), item()->parentItem()->height());
}
- QRectF sceneRect = m_item->mapRectToScene(QRectF(QPointF(0, 0), size));
- QPoint screenPos = m_item->canvas()->mapToGlobal(sceneRect.topLeft().toPoint());
+ QRectF sceneRect = item()->mapRectToScene(QRectF(QPointF(0, 0), size));
+ QPoint screenPos = item()->canvas()->mapToGlobal(sceneRect.topLeft().toPoint());
QRect r = QRect(screenPos, sceneRect.size().toSize());
if (!r.isValid()) {
- qWarning() << m_item->metaObject()->className() << m_item->property("accessibleText") << r;
+ qWarning() << item()->metaObject()->className() << item()->property("accessibleText") << r;
}
return r;
}
QRect QAccessibleQuickItem::viewRect() const
{
// ### no canvas in some cases.
- if (!m_item->canvas()) {
+ if (!item()->canvas()) {
return QRect();
}
- QQuickCanvas *canvas = m_item->canvas();
+ QQuickCanvas *canvas = item()->canvas();
QPoint screenPos = canvas->mapToGlobal(QPoint(0,0));
return QRect(screenPos, canvas->size());
}
bool QAccessibleQuickItem::clipsChildren() const
{
- return static_cast<QQuickItem *>(m_item)->clip();
+ return static_cast<QQuickItem *>(item())->clip();
}
QAccessibleInterface *QAccessibleQuickItem::parent() const
{
- QQuickItem *parent = m_item->parentItem();
+ QQuickItem *parent = item()->parentItem();
if (parent) {
- QQuickCanvas *canvas = m_item->canvas();
+ QQuickCanvas *canvas = item()->canvas();
// Jump out to the scene widget if the parent is the root item.
// There are two root items, QQuickCanvas::rootItem and
// QQuickView::declarativeRoot. The former is the true root item,
Q_UNUSED(target);
*target = 0;
if (entry == 0) {
- *target = new QAccessibleQuickItem(m_item);
+ *target = new QAccessibleQuickItem(item());
return 0;
}
return -1;
role() == QAccessible::PageTab ||
role() == QAccessible::ProgressBar)
return QList<QQuickItem *>();
- return m_item->childItems();
+ return item()->childItems();
}
QFlags<QAccessible::StateFlag> QAccessibleQuickItem::state() const
{
QAccessible::State state = QAccessible::Normal;
- if (m_item->hasActiveFocus()) {
+ if (item()->hasActiveFocus()) {
state |= QAccessible::Focused;
}
return state;
// Workaround for setAccessibleRole() not working for
// Text items. Text items are special since they are defined
// entirely from C++ (setting the role from QML works.)
- if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(m_item)))
+ if (qobject_cast<QQuickText*>(const_cast<QQuickItem *>(item())))
return QAccessible::StaticText;
- QVariant v = QQuickAccessibleAttached::property(m_item, "role");
+ QVariant v = QQuickAccessibleAttached::property(item(), "role");
bool ok;
QAccessible::Role role = (QAccessible::Role)v.toInt(&ok);
if (!ok) // Not sure if this check is needed.
bool QAccessibleQuickItem::isAccessible() const
{
- return m_item->d_func()->isAccessible;
+ return item()->d_func()->isAccessible;
}
QString QAccessibleQuickItem::text(QAccessible::Text textType) const
QVariant QAccessibleQuickItemValueInterface::currentValue()
{
- return m_item->property("value");
+ return item()->property("value");
}
void QAccessibleQuickItemValueInterface::setCurrentValue(const QVariant &value)
{
- m_item->setProperty("value", value);
+ item()->setProperty("value", value);
}
QVariant QAccessibleQuickItemValueInterface::maximumValue()
{
- return m_item->property("maximumValue");
+ return item()->property("maximumValue");
}
QVariant QAccessibleQuickItemValueInterface::minimumValue()
{
- return m_item->property("minimumValue");
+ return item()->property("minimumValue");
}
QAccessibleQuickView::QAccessibleQuickView(QQuickView *object)
:QAccessibleObject(object)
{
- m_view = static_cast<QQuickView *>(object);
}
int QAccessibleQuickView::childCount() const
{
- return m_view->rootItem() ? 1 : 0;
+ return view()->rootItem() ? 1 : 0;
}
QAccessibleInterface *QAccessibleQuickView::parent() const
QAccessibleInterface *QAccessibleQuickView::child(int index) const
{
if (index == 0) {
- QQuickItem *declarativeRoot = m_view->rootObject();
+ QQuickItem *declarativeRoot = view()->rootObject();
return new QAccessibleQuickItem(declarativeRoot);
}
return 0;
QRect QAccessibleQuickView::rect() const
{
- return QRect(m_view->x(), m_view->y(), m_view->width(), m_view->height());
+ return QRect(view()->x(), view()->y(), view()->width(), view()->height());
}
int QAccessibleQuickView::navigate(QAccessible::RelationFlag rel, int entry, QAccessibleInterface **target) const
return QString::fromAscii(object()->metaObject()->className()) ;
}
#endif
- return m_view->windowTitle();
+ return view()->windowTitle();
}
QAccessibleInterface *QAccessibleQuickView::childAt(int x, int y) const
int QAccessibleQuickView::indexOfChild(const QAccessibleInterface *iface) const
{
if (iface) {
- QQuickItem *declarativeRoot = m_view->rootObject();
+ QQuickItem *declarativeRoot = view()->rootObject();
if (declarativeRoot == iface->object())
return 1;
}