From c2e8db58413207315474232697f12ddceb8310e7 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 12 Mar 2012 19:43:03 +0100 Subject: Remove QAccessibleEvent child parameter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the api cleaner and generally the child should not be there. It is only sometimes more convenient not to create a QAccessibleInterface instance, so the functionallity is kept. Change-Id: I26018a6d3e0549f4d79856775b4167c5660e229d Reviewed-by: Jan-Arve Sæther --- src/widgets/itemviews/qabstractitemview.cpp | 2 +- src/widgets/itemviews/qlistview.cpp | 9 +++++--- src/widgets/itemviews/qtableview.cpp | 9 +++++--- src/widgets/itemviews/qtreeview.cpp | 32 ++++++----------------------- 4 files changed, 19 insertions(+), 33 deletions(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 8992a3bdfe..2ff039595a 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1112,7 +1112,7 @@ void QAbstractItemView::reset() #ifdef Q_WS_X11 if (QAccessible::isActive()) { QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); - QAccessibleEvent event(QAccessible::TableModelChanged, this, 0); + QAccessibleEvent event(this, QAccessible::TableModelChanged); QAccessible::updateAccessibility(&event); } #endif diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 872798a8e9..4547dde6e1 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3169,7 +3169,8 @@ void QListView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr if (QAccessible::isActive()) { if (current.isValid()) { int entry = visualIndex(current) + 1; - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } @@ -3189,13 +3190,15 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel) + 1; - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(entry); QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = visualIndex(desel) + 1; - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 55cf18d78c..e997f7e9d6 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3182,7 +3182,8 @@ void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &p if (current.isValid()) { Q_D(QTableView); int entry = d->accessibleTable2Index(current); - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } @@ -3204,13 +3205,15 @@ void QTableView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = d->accessibleTable2Index(sel); - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(entry); QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = d->accessibleTable2Index(desel); - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 6166823754..acc485c371 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -2934,14 +2934,6 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem & for (int i = pos + count; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem += count; -#ifndef QT_NO_ACCESSIBILITY -#ifdef Q_OS_UNIX - if (QAccessible::isActive()) { - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); - } -#endif -#endif } void QTreeViewPrivate::removeViewItems(int pos, int count) @@ -2953,14 +2945,6 @@ void QTreeViewPrivate::removeViewItems(int pos, int count) for (int i = pos; i < viewItems.count(); i++) if (items[i].parentItem >= pos) items[i].parentItem -= count; -#ifndef QT_NO_ACCESSIBILITY -#ifdef Q_OS_UNIX - if (QAccessible::isActive()) { - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); - } -#endif -#endif } #if 0 @@ -3769,16 +3753,10 @@ void QTreeView::currentChanged(const QModelIndex ¤t, const QModelIndex &pr } #ifndef QT_NO_ACCESSIBILITY if (QAccessible::isActive() && current.isValid()) { -#ifdef Q_OS_UNIX int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1; - QAccessibleEvent event(QAccessible::Focus, this, entry); + QAccessibleEvent event(this, QAccessible::Focus); + event.setChild(entry); QAccessible::updateAccessibility(&event); -#else - int entry = visualIndex(current) + 1; - if (header()) - ++entry; - QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus); -#endif } #endif } @@ -3797,14 +3775,16 @@ void QTreeView::selectionChanged(const QItemSelection &selected, if (sel.isValid()) { int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1; Q_ASSERT(entry > 0); - QAccessibleEvent event(QAccessible::Selection, this, entry); + QAccessibleEvent event(this, QAccessible::Selection); + event.setChild(entry); QAccessible::updateAccessibility(&event); } QModelIndex desel = deselected.indexes().value(0); if (desel.isValid()) { int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1; Q_ASSERT(entry > 0); - QAccessibleEvent event(QAccessible::SelectionRemove, this, entry); + QAccessibleEvent event(this, QAccessible::SelectionRemove); + event.setChild(entry); QAccessible::updateAccessibility(&event); } } -- cgit v1.2.3 From 07ff7fe52c25a1fde5f56b8a63f0d838f243b422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Thu, 15 Mar 2012 16:38:59 +0100 Subject: QHeaderView - minor fix to createSectionSpan I am unsure if this is only theoretic - but if/when we have added sections here - we must ensure that we recalculate startpositions. Change-Id: I70bf55209f1a1a885cb49748b65218879bc68776 Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 425eb4cd95..4975e72260 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3172,8 +3172,10 @@ void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool void QHeaderViewPrivate::createSectionSpan(int start, int end, int size, QHeaderView::ResizeMode mode) { int sizePerSection = size / (end - start + 1); - if (end >= sectionSpans.count()) + if (end >= sectionSpans.count()) { sectionSpans.resize(end + 1); + sectionStartposRecalc = true; + } SectionSpan *sectiondata = sectionSpans.data(); for (int i = start; i <= end; ++i) { length += (sizePerSection - sectiondata[i].size); -- cgit v1.2.3 From fcc01e6c3736991db2191c151111f03016d2d80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lund=20Martsum?= Date: Sat, 10 Mar 2012 16:47:02 +0100 Subject: QHeaderView - minor fix to setDefaultSectionSize This fixes a situation where we (wrongly) assume that a section with size 0 is hidden. However a hidden section should be one that we have called hideSection (or setSectionHidden) on. Change-Id: Ic14eded2666022f27434dc55927323a74910549c Reviewed-by: Stephen Kelly --- src/widgets/itemviews/qheaderview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets/itemviews') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 4975e72260..e82cd477c5 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3339,8 +3339,7 @@ void QHeaderViewPrivate::setDefaultSectionSize(int size) defaultSectionSize = size; for (int i = 0; i < sectionSpans.count(); ++i) { QHeaderViewPrivate::SectionSpan &span = sectionSpans[i]; - if (span.size > 0) { - //we resize it if it is not hidden (ie size > 0) + if (sectionHidden.isEmpty() || !sectionHidden.testBit(i)) { // resize on not hidden. const int newSize = size; if (newSize != span.size) { length += newSize - span.size; //the whole length is changed -- cgit v1.2.3