Index: /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 64492)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/selector/UISnapshotPane.cpp	(revision 64493)
@@ -55,88 +55,4 @@
 
 
-/** QAccessibleObject extension used as an accessibility interface for Snapshot item. */
-class UIAccessibilityInterfaceForUISnapshotItem : public QAccessibleObject
-{
-public:
-
-    /** Returns an accessibility interface for passed @a strClassname and @a pObject. */
-    static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject)
-    {
-        /* Creating Snapshot item accessibility interface: */
-        if (pObject && strClassname == QLatin1String("UISnapshotItem"))
-            return new UIAccessibilityInterfaceForUISnapshotItem(pObject);
-
-        /* Null by default: */
-        return 0;
-    }
-
-    /** Constructs an accessibility interface passing @a pObject to the base-class. */
-    UIAccessibilityInterfaceForUISnapshotItem(QObject *pObject)
-        : QAccessibleObject(pObject)
-    {}
-
-    /** Returns the parent. */
-    virtual QAccessibleInterface *parent() const /* override */;
-
-    /** Returns the number of children. */
-    virtual int childCount() const /* override */;
-    /** Returns the child with the passed @a iIndex. */
-    virtual QAccessibleInterface *child(int iIndex) const /* override */;
-    /** Returns the index of the passed @a pChild. */
-    virtual int indexOfChild(const QAccessibleInterface *pChild) const /* override */;
-
-    /** Returns the rect. */
-    virtual QRect rect() const /* override */;
-    /** Returns a text for the passed @a enmTextRole. */
-    virtual QString text(QAccessible::Text enmTextRole) const /* override */;
-
-    /** Returns the role. */
-    virtual QAccessible::Role role() const /* override */;
-    /** Returns the state. */
-    virtual QAccessible::State state() const /* override */;
-
-private:
-
-    /** Returns corresponding Snapshot item. */
-    UISnapshotItem *item() const { return qobject_cast<UISnapshotItem*>(object()); }
-};
-
-
-/** QAccessibleWidget extension used as an accessibility interface for Snapshot tree. */
-class UIAccessibilityInterfaceForUISnapshotTree : public QAccessibleWidget
-{
-public:
-
-    /** Returns an accessibility interface for passed @a strClassname and @a pObject. */
-    static QAccessibleInterface *pFactory(const QString &strClassname, QObject *pObject)
-    {
-        /* Creating Snapshot tree accessibility interface: */
-        if (pObject && strClassname == QLatin1String("UISnapshotTree"))
-            return new UIAccessibilityInterfaceForUISnapshotTree(qobject_cast<QWidget*>(pObject));
-
-        /* Null by default: */
-        return 0;
-    }
-
-    /** Constructs an accessibility interface passing @a pWidget to the base-class. */
-    UIAccessibilityInterfaceForUISnapshotTree(QWidget *pWidget)
-        : QAccessibleWidget(pWidget, QAccessible::List)
-    {}
-
-    /** Returns the number of children. */
-    virtual int childCount() const /* override */;
-    /** Returns the child with the passed @a iIndex. */
-    virtual QAccessibleInterface *child(int iIndex) const /* override */;
-
-    /** Returns a text for the passed @a enmTextRole. */
-    virtual QString text(QAccessible::Text enmTextRole) const /* override */;
-
-private:
-
-    /** Returns corresponding Snapshot tree. */
-    UISnapshotTree *tree() const { return qobject_cast<UISnapshotTree*>(widget()); }
-};
-
-
 /** QTreeWidgetItem subclass for snapshots items. */
 class UISnapshotItem : public QObject, public QTreeWidgetItem
@@ -260,191 +176,4 @@
     UISnapshotItem *childSnapshotItem(int iIndex) const;
 };
-
-
-/*********************************************************************************************************************************
-*   Class UIAccessibilityInterfaceForUISnapshotItem implementation.                                                              *
-*********************************************************************************************************************************/
-
-QAccessibleInterface *UIAccessibilityInterfaceForUISnapshotItem::parent() const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), 0);
-
-    /* Return the parent: */
-    return item()->parentSnapshotItem() ?
-           QAccessible::queryAccessibleInterface(item()->parentSnapshotItem()) :
-           QAccessible::queryAccessibleInterface(item()->parentSnapshotTree());
-}
-
-int UIAccessibilityInterfaceForUISnapshotItem::childCount() const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), 0);
-
-    /* Return the number of children: */
-    return item()->childCount();
-}
-
-QAccessibleInterface *UIAccessibilityInterfaceForUISnapshotItem::child(int iIndex) const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), 0);
-    /* Make sure index is valid: */
-    AssertReturn(iIndex >= 0 && iIndex < childCount(), 0);
-
-    /* Return the child with the passed iIndex: */
-    return QAccessible::queryAccessibleInterface(item()->childSnapshotItem(iIndex));
-}
-
-int UIAccessibilityInterfaceForUISnapshotItem::indexOfChild(const QAccessibleInterface *pChild) const
-{
-    /* Search for corresponding child: */
-    for (int i = 0; i < childCount(); ++i)
-        if (child(i) == pChild)
-            return i;
-
-    /* -1 by default: */
-    return -1;
-}
-
-QRect UIAccessibilityInterfaceForUISnapshotItem::rect() const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), QRect());
-
-    /* Compose common region: */
-    QRegion region;
-
-    /* Append item rectangle: */
-    const QRect  itemRectInViewport = item()->parentSnapshotTree()->visualItemRect(item());
-    const QSize  itemSize           = itemRectInViewport.size();
-    const QPoint itemPosInViewport  = itemRectInViewport.topLeft();
-    const QPoint itemPosInScreen    = item()->parentSnapshotTree()->viewport()->mapToGlobal(itemPosInViewport);
-    const QRect  itemRectInScreen   = QRect(itemPosInScreen, itemSize);
-    region += itemRectInScreen;
-
-    /* Append children rectangles: */
-    for (int i = 0; i < childCount(); ++i)
-        region += child(i)->rect();
-
-    /* Return common region bounding rectangle: */
-    return region.boundingRect();
-}
-
-QString UIAccessibilityInterfaceForUISnapshotItem::text(QAccessible::Text enmTextRole) const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), QString());
-
-    /* Return a text for the passed enmTextRole: */
-    switch (enmTextRole)
-    {
-        case QAccessible::Name: return item()->text(0);
-        default: break;
-    }
-
-    /* Null-string by default: */
-    return QString();
-}
-
-QAccessible::Role UIAccessibilityInterfaceForUISnapshotItem::role() const
-{
-    /* Return the role of item with children: */
-    if (childCount() > 0)
-        return QAccessible::List;
-
-    /* TreeItem by default: */
-    return QAccessible::ListItem;
-}
-
-QAccessible::State UIAccessibilityInterfaceForUISnapshotItem::state() const
-{
-    /* Make sure item still alive: */
-    AssertPtrReturn(item(), QAccessible::State());
-
-    /* Compose the state: */
-    QAccessible::State state;
-    state.focusable = true;
-    state.selectable = true;
-
-    /* Compose the state of current item: */
-    if (   item()
-        && item() == UISnapshotPane::toSnapshotItem(item()->treeWidget()->currentItem()))
-    {
-        state.active = true;
-        state.focused = true;
-        state.selected = true;
-    }
-
-    /* Return the state: */
-    return state;
-}
-
-
-/*********************************************************************************************************************************
-*   Class UIAccessibilityInterfaceForUISnapshotTree implementation.                                                              *
-*********************************************************************************************************************************/
-
-int UIAccessibilityInterfaceForUISnapshotTree::childCount() const
-{
-    /* Make sure tree still alive: */
-    AssertPtrReturn(tree(), 0);
-
-    /* Return the number of children: */
-    return tree()->childCount();
-}
-
-QAccessibleInterface *UIAccessibilityInterfaceForUISnapshotTree::child(int iIndex) const
-{
-    /* Make sure tree still alive: */
-    AssertPtrReturn(tree(), 0);
-    /* Make sure index is valid: */
-    AssertReturn(iIndex >= 0, 0);
-    if (iIndex >= childCount())
-    {
-        // WORKAROUND:
-        // Normally I would assert here, but Qt5 accessibility code has
-        // a hard-coded architecture for a tree-views which we do not like
-        // but have to live with and this architecture enumerates children
-        // of all levels as children of level 0, so Qt5 can try to address
-        // our interface with index which surely out of bounds by our laws.
-        // So let's assume that's exactly such case and try to enumerate
-        // visible children like they are a part of the list, not tree.
-        // printf("Invalid index: %d\n", iIndex);
-
-        // Visible children indexes starts with 1, not 0,
-        // don't ask me why, it's some stupid Qt5 idea:
-        const int iRequiredIndex = iIndex - 1;
-
-        // Do some sanity check as well, enough?
-        AssertReturn(iRequiredIndex >= 0, 0);
-
-        // Try to find a visible child with required index:
-        int iCurrentIndex = 0;
-        QTreeWidgetItem *pItem = tree()->topLevelItem(0);
-        while (pItem && iCurrentIndex < iRequiredIndex)
-        {
-            ++iCurrentIndex;
-            pItem = tree()->itemBelow(pItem);
-        }
-
-        // Return what we found:
-        // if (pItem)
-        //     printf("Item found: [%s]\n", pItem->text(0).toUtf8().constData());
-        return pItem ? QAccessible::queryAccessibleInterface(UISnapshotPane::toSnapshotItem(pItem)) : 0;
-    }
-
-    /* Return the child with the passed iIndex: */
-    return QAccessible::queryAccessibleInterface(tree()->childSnapshotItem(iIndex));
-}
-
-QString UIAccessibilityInterfaceForUISnapshotTree::text(QAccessible::Text /* enmTextRole */) const
-{
-    /* Make sure tree still alive: */
-    AssertPtrReturn(tree(), QString());
-
-    /* Return tree tool-tip: */
-    return tree()->toolTip();
-}
 
 
@@ -777,9 +506,4 @@
     : QTreeWidget(pParent)
 {
-    /* Install Snapshot tree accessibility interface factory: */
-    QAccessible::installFactory(UIAccessibilityInterfaceForUISnapshotTree::pFactory);
-    /* Install Snapshot item accessibility interface factory: */
-    QAccessible::installFactory(UIAccessibilityInterfaceForUISnapshotItem::pFactory);
-
     /* No header: */
     header()->hide();
