Compile.
QAccessible and QtQuick API changes. Change-Id: I5e329543937f9dd4b68dd01321c475149df4678c Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
parent
dd02fcd711
commit
019c55adbc
@ -67,7 +67,7 @@ void accessibilityUpdateHandler(QObject *object, int who, QAccessible::Event rea
|
|||||||
if (updateHandlerRecursion)
|
if (updateHandlerRecursion)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!qobject_cast<QSGItem *>(object))
|
if (!qobject_cast<QQuickItem *>(object))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateHandlerRecursion = true;
|
updateHandlerRecursion = true;
|
||||||
|
@ -60,7 +60,7 @@ void AccessibilitySceneManager::populateAccessibilityScene()
|
|||||||
if (!rootInterface)
|
if (!rootInterface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
populateAccessibilityScene(rootInterface, 0, m_scene);
|
populateAccessibilityScene(rootInterface, m_scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccessibilitySceneManager::updateAccessibilitySceneItemFlags()
|
void AccessibilitySceneManager::updateAccessibilitySceneItemFlags()
|
||||||
@ -81,10 +81,12 @@ void AccessibilitySceneManager::populateAccessibilityTreeScene()
|
|||||||
{
|
{
|
||||||
m_treeScene->clear();
|
m_treeScene->clear();
|
||||||
QAccessibleInterface * rootInterface = m_window->accessibleRoot();
|
QAccessibleInterface * rootInterface = m_window->accessibleRoot();
|
||||||
if (!rootInterface)
|
if (!rootInterface) {
|
||||||
|
qWarning("QWindow::accessibleRoot returned 0");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
populateAccessibilityTreeScene(rootInterface, 0);
|
populateAccessibilityTreeScene(rootInterface);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event reason)
|
void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event reason)
|
||||||
@ -93,11 +95,11 @@ void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event
|
|||||||
if (!interface)
|
if (!interface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString name = interface->text(QAccessible::Name, 0);
|
QString name = interface->text(QAccessible::Name);
|
||||||
|
|
||||||
if (reason == QAccessible::ObjectCreated) {
|
if (reason == QAccessible::ObjectCreated) {
|
||||||
// qDebug() << "ObjectCreated" << object << name;
|
// qDebug() << "ObjectCreated" << object << name;
|
||||||
populateAccessibilityScene(interface, 0, m_scene);
|
populateAccessibilityScene(interface, m_scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsRectItem *item = m_graphicsItems.value(object);
|
QGraphicsRectItem *item = m_graphicsItems.value(object);
|
||||||
@ -110,7 +112,7 @@ void AccessibilitySceneManager::handleUpdate(QObject *object, QAccessible::Event
|
|||||||
if (reason == QAccessible::LocationChanged) {
|
if (reason == QAccessible::LocationChanged) {
|
||||||
|
|
||||||
//if (name.startsWith("List"))
|
//if (name.startsWith("List"))
|
||||||
qDebug() << "locationChange" << object << name << interface->rect(0);
|
qDebug() << "locationChange" << object << name << interface->rect();
|
||||||
|
|
||||||
updateItem(item, interface);
|
updateItem(item, interface);
|
||||||
for (int i = 0; i < interface->childCount(); ++i) {
|
for (int i = 0; i < interface->childCount(); ++i) {
|
||||||
@ -221,7 +223,7 @@ void AccessibilitySceneManager::updateItem(QGraphicsRectItem *item, QAccessibleI
|
|||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QRect rect = interface->rect(0);
|
QRect rect = interface->rect();
|
||||||
item->setPos(rect.topLeft());
|
item->setPos(rect.topLeft());
|
||||||
item->setRect(QRect(QPoint(0,0), rect.size()));
|
item->setRect(QRect(QPoint(0,0), rect.size()));
|
||||||
|
|
||||||
@ -241,13 +243,13 @@ void AccessibilitySceneManager::updateItemFlags(QGraphicsRectItem *item, QAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_optionsWidget->hideOffscreenItems()) {
|
if (m_optionsWidget->hideOffscreenItems()) {
|
||||||
if (interface->state(0) & QAccessible::Offscreen) {
|
if (interface->state() & QAccessible::Offscreen) {
|
||||||
shouldShow = false;
|
shouldShow = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_optionsWidget->hidePaneItems()) {
|
if (m_optionsWidget->hidePaneItems()) {
|
||||||
if (interface->role(0) & QAccessible::Pane) {
|
if (interface->role() & QAccessible::Pane) {
|
||||||
shouldShow = false;
|
shouldShow = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,7 +264,7 @@ void AccessibilitySceneManager::updateItemFlags(QGraphicsRectItem *item, QAccess
|
|||||||
m_view->update();
|
m_view->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsRectItem * AccessibilitySceneManager::processInterface(QAccessibleInterface * interface, int child, QGraphicsScene *scene)
|
QGraphicsRectItem * AccessibilitySceneManager::processInterface(QAccessibleInterface * interface, QGraphicsScene *scene)
|
||||||
{
|
{
|
||||||
// Process this interface
|
// Process this interface
|
||||||
|
|
||||||
@ -271,9 +273,9 @@ QGraphicsRectItem * AccessibilitySceneManager::processInterface(QAccessibleInter
|
|||||||
if (!m_rootItem)
|
if (!m_rootItem)
|
||||||
m_rootItem = item;
|
m_rootItem = item;
|
||||||
|
|
||||||
QString name = interface->text(QAccessibleInterface::Name, child);
|
QString name = interface->text(QAccessibleInterface::Name);
|
||||||
QString description; // = interface->text(QAccessibleInterface::Description, child);
|
QString description; // = interface->text(QAccessibleInterface::Description, child);
|
||||||
QString role = translateRole(interface->role(child));
|
QString role = translateRole(interface->role());
|
||||||
int childCount = interface->childCount();
|
int childCount = interface->childCount();
|
||||||
|
|
||||||
/* qDebug() << "name:" << name << "local pos" <<
|
/* qDebug() << "name:" << name << "local pos" <<
|
||||||
@ -303,26 +305,22 @@ QGraphicsRectItem * AccessibilitySceneManager::processInterface(QAccessibleInter
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccessibilitySceneManager::populateAccessibilityScene(QAccessibleInterface * interface, int child, QGraphicsScene *scene)
|
void AccessibilitySceneManager::populateAccessibilityScene(QAccessibleInterface * interface, QGraphicsScene *scene)
|
||||||
{
|
{
|
||||||
if (!interface)
|
if (!interface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QGraphicsRectItem *item = processInterface(interface, child, scene);
|
QGraphicsRectItem *item = processInterface(interface, scene);
|
||||||
|
|
||||||
QObject *object = interface->object();
|
QObject *object = interface->object();
|
||||||
if (object) {
|
if (object) {
|
||||||
m_graphicsItems.insert(object, item);
|
m_graphicsItems.insert(object, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possibly process children
|
|
||||||
if (child != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < interface->childCount(); ++i) {
|
for (int i = 0; i < interface->childCount(); ++i) {
|
||||||
QAccessibleInterface *child = interface->child(i);
|
QAccessibleInterface *child = interface->child(i);
|
||||||
updateItems(child->object());
|
updateItems(child->object());
|
||||||
populateAccessibilityScene(child, 0, scene);
|
populateAccessibilityScene(child, scene);
|
||||||
delete child;
|
delete child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,17 +350,17 @@ AccessibilitySceneManager::TreeItem AccessibilitySceneManager::computeLevels(QAc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// capture information:
|
// capture information:
|
||||||
currentLevel.name = interface->text(QAccessible::Name, 0);
|
currentLevel.name = interface->text(QAccessible::Name);
|
||||||
//currentLevel.description += interface->text(QAccessible::DebugDescription, 0);
|
//currentLevel.description += interface->text(QAccessible::DebugDescription);
|
||||||
currentLevel.role = translateRole(interface->role(0));
|
currentLevel.role = translateRole(interface->role());
|
||||||
currentLevel.rect = interface->rect(0);
|
currentLevel.rect = interface->rect();
|
||||||
currentLevel.state = interface->state(0);
|
currentLevel.state = interface->state();
|
||||||
currentLevel.object = interface->object();
|
currentLevel.object = interface->object();
|
||||||
|
|
||||||
return currentLevel;
|
return currentLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccessibilitySceneManager::populateAccessibilityTreeScene(QAccessibleInterface * interface, int child)
|
void AccessibilitySceneManager::populateAccessibilityTreeScene(QAccessibleInterface * interface)
|
||||||
{
|
{
|
||||||
if (!interface)
|
if (!interface)
|
||||||
return;
|
return;
|
||||||
@ -472,7 +470,7 @@ bool AccessibilitySceneManager::isHidden(QAccessibleInterface *interface)
|
|||||||
QAccessibleInterface *current = interface;
|
QAccessibleInterface *current = interface;
|
||||||
while (current) {
|
while (current) {
|
||||||
|
|
||||||
if (current->state(0) & QAccessible::Invisible) {
|
if (current->state() & QAccessible::Invisible) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,12 +73,12 @@ private:
|
|||||||
void updateItem(QGraphicsRectItem *item, QAccessibleInterface *interface);
|
void updateItem(QGraphicsRectItem *item, QAccessibleInterface *interface);
|
||||||
void updateItemFlags(QGraphicsRectItem *item, QAccessibleInterface *interface);
|
void updateItemFlags(QGraphicsRectItem *item, QAccessibleInterface *interface);
|
||||||
|
|
||||||
void populateAccessibilityScene(QAccessibleInterface * interface, int child, QGraphicsScene *scene);
|
void populateAccessibilityScene(QAccessibleInterface * interface, QGraphicsScene *scene);
|
||||||
QGraphicsRectItem * processInterface(QAccessibleInterface * interface, int child, QGraphicsScene *scene);
|
QGraphicsRectItem * processInterface(QAccessibleInterface * interface, QGraphicsScene *scene);
|
||||||
|
|
||||||
struct TreeItem;
|
struct TreeItem;
|
||||||
TreeItem computeLevels(QAccessibleInterface * interface, int level);
|
TreeItem computeLevels(QAccessibleInterface * interface, int level);
|
||||||
void populateAccessibilityTreeScene(QAccessibleInterface * interface, int child);
|
void populateAccessibilityTreeScene(QAccessibleInterface * interface);
|
||||||
void addGraphicsItems(TreeItem item, int row, int xPos);
|
void addGraphicsItems(TreeItem item, int row, int xPos);
|
||||||
|
|
||||||
bool isHidden(QAccessibleInterface *interface);
|
bool isHidden(QAccessibleInterface *interface);
|
||||||
|
@ -126,7 +126,7 @@ void ScreenReader::processTouchPoint()
|
|||||||
m_selectedInterface = currentInterface;
|
m_selectedInterface = currentInterface;
|
||||||
emit selected(m_selectedInterface->object());
|
emit selected(m_selectedInterface->object());
|
||||||
if (m_optionsWidget->enableTextToSpeach())
|
if (m_optionsWidget->enableTextToSpeach())
|
||||||
speak(m_selectedInterface->text(QAccessible::Name, 0)
|
speak(m_selectedInterface->text(QAccessible::Name)
|
||||||
/*+ "," + translateRole(m_selectedInterface->role(0)) */);
|
/*+ "," + translateRole(m_selectedInterface->role(0)) */);
|
||||||
|
|
||||||
// qDebug() << "touchPoint exit found" << m_selectedInterface->text(QAccessible::Name, 0) << m_selectedInterface->object() << m_selectedInterface->rect(0);
|
// qDebug() << "touchPoint exit found" << m_selectedInterface->text(QAccessible::Name, 0) << m_selectedInterface->object() << m_selectedInterface->rect(0);
|
||||||
@ -137,7 +137,7 @@ void ScreenReader::activate()
|
|||||||
qDebug() << "ScreenReader::activate";
|
qDebug() << "ScreenReader::activate";
|
||||||
m_activateCalled = true;
|
m_activateCalled = true;
|
||||||
if (m_selectedInterface) {
|
if (m_selectedInterface) {
|
||||||
m_selectedInterface->doAction(QAccessible::Press, 0);
|
m_selectedInterface->actionInterface()->doAction(QAccessibleActionInterface::pressAction());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user