From f98b97bc0add4552f1fb6f52092359f7a1b881fc Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 22 Apr 2014 12:48:33 +0200 Subject: [PATCH 07/12] Improve updating of the current object --- examples/accessibleapps/accessibleproperties.cpp | 4 ++-- examples/accessibleapps/accessibletree.cpp | 2 +- examples/accessibleapps/mainwindow.cpp | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/examples/accessibleapps/accessibleproperties.cpp b/examples/accessibleapps/accessibleproperties.cpp index 101c7e2..ab781b5 100644 --- a/examples/accessibleapps/accessibleproperties.cpp +++ b/examples/accessibleapps/accessibleproperties.cpp @@ -27,6 +27,8 @@ using namespace QAccessibleClient; ObjectProperties::ObjectProperties(QObject *parent) : QStandardItemModel(parent) { + setColumnCount(2); + setHorizontalHeaderLabels( QStringList() << QString("Property") << QString("Value") ); } ObjectProperties::~ObjectProperties() @@ -47,8 +49,6 @@ void ObjectProperties::setAccessibleObject(const QAccessibleClient::AccessibleOb m_acc = acc; clear(); - setColumnCount(2); - setHorizontalHeaderLabels( QStringList() << QString("Property") << QString("Value") ); if (!acc.isValid()) { endResetModel(); diff --git a/examples/accessibleapps/accessibletree.cpp b/examples/accessibleapps/accessibletree.cpp index 8ddcee6..b236025 100644 --- a/examples/accessibleapps/accessibletree.cpp +++ b/examples/accessibleapps/accessibletree.cpp @@ -226,7 +226,7 @@ QModelIndex AccessibleTree::indexForAccessible(const AccessibleObject& object) if (parent.isValid()) { QModelIndex parentIndex = indexForAccessible(parent); if (!parentIndex.isValid()) { - qWarning() << Q_FUNC_INFO << "Parent model index is invalid: " << object; + qWarning() << Q_FUNC_INFO << object.application().name() << object.name() << object.roleName() << "Parent model index is invalid: " << object; return QModelIndex(); } int indexInParent = object.indexInParent(); diff --git a/examples/accessibleapps/mainwindow.cpp b/examples/accessibleapps/mainwindow.cpp index 136f828..a0d4e26 100644 --- a/examples/accessibleapps/mainwindow.cpp +++ b/examples/accessibleapps/mainwindow.cpp @@ -295,26 +295,31 @@ void MainWindow::stateChanged(const QAccessibleClient::AccessibleObject &object, void MainWindow::childAdded(const QAccessibleClient::AccessibleObject &object, int childIndex) { + updateDetails(object); m_eventsWidget->addLog(object, EventsWidget::Object, QLatin1String("ChildAdded ") + QString::number(childIndex)); } void MainWindow::childRemoved(const QAccessibleClient::AccessibleObject &object, int childIndex) { + updateDetails(object); m_eventsWidget->addLog(object, EventsWidget::Object, QLatin1String("ChildRemoved ") + QString::number(childIndex)); } void MainWindow::visibleDataChanged(const QAccessibleClient::AccessibleObject &object) { + updateDetails(object); m_eventsWidget->addLog(object, EventsWidget::Object, "VisibleDataChanged"); } void MainWindow::selectionChanged(const QAccessibleClient::AccessibleObject &object) { + updateDetails(object); m_eventsWidget->addLog(object, EventsWidget::Table, "SelectionChanged"); } void MainWindow::modelChanged(const QAccessibleClient::AccessibleObject &object) { + updateDetails(object); m_eventsWidget->addLog(object, EventsWidget::Table, "ModelChanged"); } @@ -460,6 +465,8 @@ void MainWindow::focusChanged(const QAccessibleClient::AccessibleObject &object) setCurrentObject(object); m_accessibleObjectTreeView->setFocusPolicy(prevFocusPolicy); + } else { + updateDetails(object); } } -- 2.9.4