summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp18
-rw-r--r--src/widgets/itemviews/qheaderview.cpp130
-rw-r--r--src/widgets/itemviews/qheaderview.h27
-rw-r--r--src/widgets/itemviews/qlistview.cpp9
-rw-r--r--src/widgets/itemviews/qtableview.cpp50
-rw-r--r--src/widgets/itemviews/qtreeview.cpp19
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
8 files changed, 171 insertions, 86 deletions
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 6184a5845a..ecba3e238f 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -243,6 +243,8 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *,
/*!
+ \since 5.0
+
A function called when the editor is no longer needed and should be
destroyed. The default behavior is a call to deleteLater on the editor.
It possible e.g. to avoid this delete by reimplementing this function.
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 8530e2c23e..8992a3bdfe 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1112,7 +1112,8 @@ void QAbstractItemView::reset()
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, this, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, this, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3342,7 +3343,8 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3422,7 +3424,8 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3445,7 +3448,8 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3469,7 +3473,8 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3497,7 +3502,8 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index eac543d37d..425eb4cd95 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -120,9 +120,9 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
\section1 Moving Header Sections
- A header can be fixed in place, or made movable with setMovable(). It can
- be made clickable with setClickable(), and has resizing behavior in
- accordance with setResizeMode().
+ A header can be fixed in place, or made movable with setSectionsMovable(). It can
+ be made clickable with setSectionsClickable(), and has resizing behavior in
+ accordance with setResizeMode() and setSectionResizeMode()
\note Double-clicking on a header to resize a section only applies for
visible rows.
@@ -185,7 +185,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
The following values are obsolete:
\value Custom Use Fixed instead.
- \sa setResizeMode() stretchLastSection minimumSectionSize
+ \sa setResizeMode() setSectionResizeMode() stretchLastSection minimumSectionSize
*/
/*!
@@ -216,7 +216,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
This signal is emitted when a section is pressed. The section's logical
index is specified by \a logicalIndex.
- \sa setClickable()
+ \sa setSectionsClickable()
*/
/*!
@@ -227,7 +227,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
Note that the sectionPressed signal will also be emitted.
- \sa setClickable(), sectionPressed()
+ \sa setSectionsClickable(), sectionPressed()
*/
/*!
@@ -238,7 +238,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
mouse button is pressed. The section's logical index is specified by
\a logicalIndex.
- \sa setClickable(), sectionPressed()
+ \sa setSectionsClickable(), sectionPressed()
*/
/*!
@@ -247,7 +247,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
This signal is emitted when a section is double-clicked. The section's
logical index is specified by \a logicalIndex.
- \sa setClickable()
+ \sa setSectionsClickable()
*/
/*!
@@ -266,7 +266,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
This signal is emitted when a section is double-clicked. The section's
logical index is specified by \a logicalIndex.
- \sa setClickable()
+ \sa setSectionsClickable()
*/
/*!
@@ -866,9 +866,11 @@ void QHeaderView::swapSections(int first, int second)
\fn void QHeaderView::resizeSection(int logicalIndex, int size)
Resizes the section specified by \a logicalIndex to \a size measured in
- pixels.
+ pixels. The size parameter must be a value larger or equal to zero. A
+ size equal to zero is however not recommended. In that situation hideSection
+ should be used instead.
- \sa sectionResized(), resizeMode(), sectionSize()
+ \sa sectionResized(), resizeMode(), sectionSize(), hideSection()
*/
void QHeaderView::resizeSection(int logical, int size)
@@ -1085,62 +1087,98 @@ int QHeaderView::logicalIndex(int visualIndex) const
}
/*!
- If \a movable is true, the header may be moved by the user; otherwise it
+ If \a sectionsMovable is true, the header may be moved by the user; otherwise it
is fixed in place.
- \sa isMovable(), sectionMoved()
+ \sa sectionsMovable(), sectionMoved()
*/
-// ### Qt 5: change to setSectionsMovable()
-void QHeaderView::setMovable(bool movable)
+void QHeaderView::setSectionsMovable(bool movable)
{
Q_D(QHeaderView);
d->movableSections = movable;
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \obsolete
+ \fn void QHeaderView::setMovable(bool movable)
+
+ Use setSectionsMovable instead.
+
+ \sa setSectionsMovable()
+*/
+
/*!
Returns true if the header can be moved by the user; otherwise returns
false.
- \sa setMovable()
+ \sa setSectionsMovable()
*/
-// ### Qt 5: change to sectionsMovable()
-bool QHeaderView::isMovable() const
+bool QHeaderView::sectionsMovable() const
{
Q_D(const QHeaderView);
return d->movableSections;
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \obsolete
+ \fn bool QHeaderView::isMovable(bool movable)
+
+ Use sectionsMovable instead.
+
+ \sa sectionsMovable()
+*/
+
/*!
If \a clickable is true, the header will respond to single clicks.
- \sa isClickable(), sectionClicked(), sectionPressed(),
+ \sa sectionsClickable(), sectionClicked(), sectionPressed(),
setSortIndicatorShown()
*/
-// ### Qt 5: change to setSectionsClickable()
-void QHeaderView::setClickable(bool clickable)
+void QHeaderView::setSectionsClickable(bool clickable)
{
Q_D(QHeaderView);
d->clickableSections = clickable;
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \obsolete
+ \fn void QHeaderView::setClickable(bool clickable)
+
+ Use setSectionsClickable instead.
+
+ \sa setSectionsClickable()
+*/
+
/*!
Returns true if the header is clickable; otherwise returns false. A
clickable header could be set up to allow the user to change the
representation of the data in the view related to the header.
- \sa setClickable()
+ \sa setSectionsClickable()
*/
-// ### Qt 5: change to sectionsClickable()
-bool QHeaderView::isClickable() const
+bool QHeaderView::sectionsClickable() const
{
Q_D(const QHeaderView);
return d->clickableSections;
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \obsolete
+ \fn bool QHeaderView::isClickable() const
+
+ Use sectionsClickable instead.
+
+ \sa sectionsClickable()
+*/
+
void QHeaderView::setHighlightSections(bool highlight)
{
Q_D(QHeaderView);
@@ -1172,8 +1210,6 @@ void QHeaderView::setResizeMode(ResizeMode mode)
}
/*!
- \overload
-
Sets the constraints on how the section specified by \a logicalIndex in
the header can be resized to those described by the given \a mode. The logical
index should exist at the time this function is called.
@@ -1185,8 +1221,7 @@ void QHeaderView::setResizeMode(ResizeMode mode)
\sa setStretchLastSection()
*/
-// ### Qt 5: change to setSectionResizeMode()
-void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode)
+void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode)
{
Q_D(QHeaderView);
int visual = visualIndex(logicalIndex);
@@ -1208,6 +1243,17 @@ void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode)
d->doDelayedResizeSections(); // section sizes may change as a result of the new mode
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \overload
+ \obsolete
+ \fn void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode)
+
+ Use setSectionResizeMode instead.
+
+ \sa setSectionResizeMode()
+*/
+
/*!
Returns the resize mode that applies to the section specified by the given
\a logicalIndex.
@@ -1215,7 +1261,7 @@ void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode)
\sa setResizeMode()
*/
-QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const
+QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const
{
Q_D(const QHeaderView);
int visual = visualIndex(logicalIndex);
@@ -1224,6 +1270,16 @@ QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const
return d->headerSectionResizeMode(visual);
}
+// ### Qt 6 - remove this obsolete function
+/*!
+ \obsolete
+ \fn QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const
+
+ Use sectionResizeMode instead.
+
+ \sa sectionResizeMode()
+*/
+
/*!
\since 4.1
@@ -1246,7 +1302,7 @@ int QHeaderView::stretchSectionCount() const
By default, this property is false.
- \sa setClickable()
+ \sa setSectionsClickable()
*/
void QHeaderView::setSortIndicatorShown(bool show)
@@ -1299,8 +1355,8 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
}
if (old != logicalIndex
- && ((logicalIndex >= 0 && resizeMode(logicalIndex) == ResizeToContents)
- || old >= d->sectionCount() || (old >= 0 && resizeMode(old) == ResizeToContents))) {
+ && ((logicalIndex >= 0 && sectionResizeMode(logicalIndex) == ResizeToContents)
+ || old >= d->sectionCount() || (old >= 0 && sectionResizeMode(old) == ResizeToContents))) {
resizeSections();
d->viewport->update();
} else {
@@ -2207,7 +2263,7 @@ void QHeaderView::mousePressEvent(QMouseEvent *e)
updateSection(d->pressed);
d->state = QHeaderViewPrivate::SelectSections;
}
- } else if (resizeMode(handle) == Interactive) {
+ } else if (sectionResizeMode(handle) == Interactive) {
d->originalSize = sectionSize(handle);
d->state = QHeaderViewPrivate::ResizeSection;
d->section = handle;
@@ -2289,7 +2345,7 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
#ifndef QT_NO_CURSOR
int handle = d->sectionHandleAt(pos);
bool hasCursor = testAttribute(Qt::WA_SetCursor);
- if (handle != -1 && (resizeMode(handle) == Interactive)) {
+ if (handle != -1 && (sectionResizeMode(handle) == Interactive)) {
if (!hasCursor)
setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
} else if (hasCursor) {
@@ -2360,7 +2416,7 @@ void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
Q_D(QHeaderView);
int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
int handle = d->sectionHandleAt(pos);
- if (handle > -1 && resizeMode(handle) == Interactive) {
+ if (handle > -1 && sectionResizeMode(handle) == Interactive) {
emit sectionHandleDoubleClicked(handle);
#ifndef QT_NO_CURSOR
Qt::CursorShape splitCursor = (d->orientation == Qt::Horizontal)
@@ -2368,7 +2424,7 @@ void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e)
if (cursor().shape() == splitCursor) {
// signal handlers may have changed the section size
handle = d->sectionHandleAt(pos);
- if (!(handle > -1 && resizeMode(handle) == Interactive))
+ if (!(handle > -1 && sectionResizeMode(handle) == Interactive))
setCursor(Qt::ArrowCursor);
}
#endif
@@ -2673,7 +2729,7 @@ void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot
int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row();
int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row();
for (int i = first; i <= last && !resizeRequired; ++i)
- resizeRequired = (resizeMode(i) == ResizeToContents);
+ resizeRequired = (sectionResizeMode(i) == ResizeToContents);
if (resizeRequired)
d->doDelayedResizeSections();
}
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index d72b8cd735..bf686e2925 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -114,18 +114,33 @@ public:
int visualIndex(int logicalIndex) const;
int logicalIndex(int visualIndex) const;
- void setMovable(bool movable);
- bool isMovable() const;
+ void setSectionsMovable(bool movable);
+ bool sectionsMovable() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED void setMovable(bool movable) { setSectionsMovable(movable); }
+ inline QT_DEPRECATED bool isMovable() const { return sectionsMovable(); }
+#endif
- void setClickable(bool clickable);
- bool isClickable() const;
+ void setSectionsClickable(bool clickable);
+ bool sectionsClickable() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED void setClickable(bool clickable) { setSectionsClickable(clickable); }
+ inline QT_DEPRECATED bool isClickable() const { return sectionsClickable(); }
+#endif
void setHighlightSections(bool highlight);
bool highlightSections() const;
void setResizeMode(ResizeMode mode);
- void setResizeMode(int logicalIndex, ResizeMode mode);
- ResizeMode resizeMode(int logicalIndex) const;
+ ResizeMode sectionResizeMode(int logicalIndex) const;
+ void setSectionResizeMode(int logicalIndex, ResizeMode mode);
+#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED void setResizeMode(int logicalindex, ResizeMode mode)
+ { setSectionResizeMode(logicalindex, mode); }
+ inline QT_DEPRECATED ResizeMode resizeMode(int logicalindex) const
+ { return sectionResizeMode(logicalindex); }
+#endif
+
int stretchSectionCount() const;
void setSortIndicatorShown(bool show);
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index b00b1073a3..872798a8e9 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -3169,7 +3169,8 @@ void QListView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive()) {
if (current.isValid()) {
int entry = visualIndex(current) + 1;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
+ QAccessibleEvent event(QAccessible::Focus, this, entry);
+ QAccessible::updateAccessibility(&event);
}
}
#endif
@@ -3188,12 +3189,14 @@ void QListView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = visualIndex(sel) + 1;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
+ QAccessibleEvent event(QAccessible::Selection, this, entry);
+ QAccessible::updateAccessibility(&event);
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
int entry = visualIndex(desel) + 1;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
+ QAccessibleEvent event(QAccessible::SelectionRemove, this, entry);
+ QAccessible::updateAccessibility(&event);
}
}
#endif
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index d3bc826750..55cf18d78c 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -616,12 +616,12 @@ void QTableViewPrivate::init()
q->setEditTriggers(editTriggers|QAbstractItemView::AnyKeyPressed);
QHeaderView *vertical = new QHeaderView(Qt::Vertical, q);
- vertical->setClickable(true);
+ vertical->setSectionsClickable(true);
vertical->setHighlightSections(true);
q->setVerticalHeader(vertical);
QHeaderView *horizontal = new QHeaderView(Qt::Horizontal, q);
- horizontal->setClickable(true);
+ horizontal->setSectionsClickable(true);
horizontal->setHighlightSections(true);
q->setHorizontalHeader(horizontal);
@@ -1071,6 +1071,10 @@ void QTableView::setModel(QAbstractItemModel *model)
disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
}
+ if (d->selectionModel) { // support row editing
+ disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
+ d->model, SLOT(submit()));
+ }
if (model) { //and connect to the new one
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
@@ -1123,9 +1127,21 @@ void QTableView::setSelectionModel(QItemSelectionModel *selectionModel)
{
Q_D(QTableView);
Q_ASSERT(selectionModel);
+ if (d->selectionModel) {
+ // support row editing
+ disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
+ d->model, SLOT(submit()));
+ }
+
d->verticalHeader->setSelectionModel(selectionModel);
d->horizontalHeader->setSelectionModel(selectionModel);
QAbstractItemView::setSelectionModel(selectionModel);
+
+ if (d->selectionModel) {
+ // support row editing
+ connect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
+ d->model, SLOT(submit()));
+ }
}
/*!
@@ -3164,16 +3180,10 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
if (current.isValid()) {
-#ifdef Q_OS_UNIX
Q_D(QTableView);
int entry = d->accessibleTable2Index(current);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
-#else
- int entry = visualIndex(current) + 1;
- if (horizontalHeader())
- ++entry;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, viewport(), entry));
-#endif
+ QAccessibleEvent event(QAccessible::Focus, this, entry);
+ QAccessible::updateAccessibility(&event);
}
}
#endif
@@ -3193,27 +3203,15 @@ void QTableView::selectionChanged(const QItemSelection &selected,
// ### does not work properly for selection ranges.
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
-#ifdef Q_OS_UNIX
int entry = d->accessibleTable2Index(sel);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
-#else
- int entry = visualIndex(sel);
- if (horizontalHeader())
- ++entry;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, viewport(), entry));
-#endif
+ QAccessibleEvent event(QAccessible::Selection, this, entry);
+ QAccessible::updateAccessibility(&event);
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
-#ifdef Q_OS_UNIX
int entry = d->accessibleTable2Index(desel);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
-#else
- int entry = visualIndex(sel);
- if (horizontalHeader())
- ++entry;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, viewport(), entry));
-#endif
+ QAccessibleEvent event(QAccessible::SelectionRemove, this, entry);
+ QAccessible::updateAccessibility(&event);
}
}
#endif
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index c54c11d0f5..6166823754 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -848,7 +848,7 @@ void QTreeView::setSortingEnabled(bool enable)
{
Q_D(QTreeView);
header()->setSortIndicatorShown(enable);
- header()->setClickable(enable);
+ header()->setSectionsClickable(enable);
if (enable) {
//sortByColumn has to be called before we connect or set the sortingEnabled flag
// because otherwise it will not call sort on the model.
@@ -2886,7 +2886,7 @@ void QTreeViewPrivate::initialize()
q->setAttribute(Qt::WA_MacShowFocusRect);
QHeaderView *header = new QHeaderView(Qt::Horizontal, q);
- header->setMovable(true);
+ header->setSectionsMovable(true);
header->setStretchLastSection(true);
header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter);
q->setHeader(header);
@@ -2937,7 +2937,8 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_OS_UNIX
if (QAccessible::isActive()) {
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -2955,7 +2956,8 @@ void QTreeViewPrivate::removeViewItems(int pos, int count)
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_OS_UNIX
if (QAccessible::isActive()) {
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
+ QAccessibleEvent event(QAccessible::TableModelChanged, q, 0);
+ QAccessible::updateAccessibility(&event);
}
#endif
#endif
@@ -3769,7 +3771,8 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive() && current.isValid()) {
#ifdef Q_OS_UNIX
int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1;
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
+ QAccessibleEvent event(QAccessible::Focus, this, entry);
+ QAccessible::updateAccessibility(&event);
#else
int entry = visualIndex(current) + 1;
if (header())
@@ -3794,13 +3797,15 @@ 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);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
+ QAccessibleEvent event(QAccessible::Selection, this, 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);
- QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
+ QAccessibleEvent event(QAccessible::SelectionRemove, this, entry);
+ QAccessible::updateAccessibility(&event);
}
}
#endif
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 156121a533..f8e3a375a4 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -2535,7 +2535,7 @@ QTreeWidget::QTreeWidget(QWidget *parent)
this, SLOT(_q_sort()));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(_q_selectionChanged(QItemSelection,QItemSelection)));
- header()->setClickable(false);
+ header()->setSectionsClickable(false);
}
/*!