diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 35466fcf5f..eeb0b5ac5a 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -975,7 +975,7 @@ void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter, \internal Updates spans after row insertion. */ -void QTableViewPrivate::_q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end) +void QTableViewPrivate::updateSpanInsertedRows(const QModelIndex &parent, int start, int end) { Q_UNUSED(parent); spans.updateInsertedRows(start, end); @@ -985,7 +985,7 @@ void QTableViewPrivate::_q_updateSpanInsertedRows(const QModelIndex &parent, int \internal Updates spans after column insertion. */ -void QTableViewPrivate::_q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end) +void QTableViewPrivate::updateSpanInsertedColumns(const QModelIndex &parent, int start, int end) { Q_UNUSED(parent); spans.updateInsertedColumns(start, end); @@ -995,7 +995,7 @@ void QTableViewPrivate::_q_updateSpanInsertedColumns(const QModelIndex &parent, \internal Updates spans after row removal. */ -void QTableViewPrivate::_q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end) +void QTableViewPrivate::updateSpanRemovedRows(const QModelIndex &parent, int start, int end) { Q_UNUSED(parent); spans.updateRemovedRows(start, end); @@ -1005,7 +1005,7 @@ void QTableViewPrivate::_q_updateSpanRemovedRows(const QModelIndex &parent, int \internal Updates spans after column removal. */ -void QTableViewPrivate::_q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end) +void QTableViewPrivate::updateSpanRemovedColumns(const QModelIndex &parent, int start, int end) { Q_UNUSED(parent); spans.updateRemovedColumns(start, end); @@ -1015,7 +1015,7 @@ void QTableViewPrivate::_q_updateSpanRemovedColumns(const QModelIndex &parent, i \internal Sort the model when the header sort indicator changed */ -void QTableViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order) +void QTableViewPrivate::sortIndicatorChanged(int column, Qt::SortOrder order) { model->sort(column, order); } @@ -1272,13 +1272,13 @@ void QTableView::setModel(QAbstractItemModel *model) if (model) { //and connect to the new one d->modelConnections = { QObjectPrivate::connect(model, &QAbstractItemModel::rowsInserted, - d, &QTableViewPrivate::_q_updateSpanInsertedRows), + d, &QTableViewPrivate::updateSpanInsertedRows), QObjectPrivate::connect(model, &QAbstractItemModel::columnsInserted, - d, &QTableViewPrivate::_q_updateSpanInsertedColumns), + d, &QTableViewPrivate::updateSpanInsertedColumns), QObjectPrivate::connect(model, &QAbstractItemModel::rowsRemoved, - d, &QTableViewPrivate::_q_updateSpanRemovedRows), + d, &QTableViewPrivate::updateSpanRemovedRows), QObjectPrivate::connect(model, &QAbstractItemModel::columnsRemoved, - d, &QTableViewPrivate::_q_updateSpanRemovedColumns) + d, &QTableViewPrivate::updateSpanRemovedColumns) }; } d->verticalHeader->setModel(model); @@ -1435,8 +1435,8 @@ void QTableView::setVerticalHeader(QHeaderView *header) this, &QTableView::resizeRowToContents), connect(d->verticalHeader, &QHeaderView::geometriesChanged, this, &QTableView::updateGeometries), - QObjectPrivate::connect(d->verticalHeader, &QHeaderView::sectionEntered, - d, &QTableViewPrivate::_q_selectRow) + connect(d->verticalHeader, &QHeaderView::sectionEntered, + this, [d](int row) { d->selectRow(row, false); }) }; } @@ -2739,14 +2739,14 @@ void QTableView::setSortingEnabled(bool enable) d->horizontalHeader->sortIndicatorOrder()); d->dynHorHeaderConnections = { QObjectPrivate::connect(d->horizontalHeader, &QHeaderView::sortIndicatorChanged, - d, &QTableViewPrivate::_q_sortIndicatorChanged) + d, &QTableViewPrivate::sortIndicatorChanged) }; } else { d->dynHorHeaderConnections = { connect(d->horizontalHeader, &QHeaderView::sectionPressed, this, &QTableView::selectColumn), - QObjectPrivate::connect(d->horizontalHeader, &QHeaderView::sectionEntered, - d, &QTableViewPrivate::_q_selectColumn) + connect(d->horizontalHeader, &QHeaderView::sectionEntered, + this, [d](int column) {d->selectColumn(column, false); }) }; } d->sortingEnabled = enable; @@ -3407,16 +3407,6 @@ void QTableView::clearSpans() d->viewport->update(); } -void QTableViewPrivate::_q_selectRow(int row) -{ - selectRow(row, false); -} - -void QTableViewPrivate::_q_selectColumn(int column) -{ - selectColumn(column, false); -} - void QTableViewPrivate::selectRow(int row, bool anchor) { Q_Q(QTableView); diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h index 5e4e17b2ef..862a016d5f 100644 --- a/src/widgets/itemviews/qtableview_p.h +++ b/src/widgets/itemviews/qtableview_p.h @@ -225,17 +225,14 @@ public: QRect visualSpanRect(const QSpanCollection::Span &span) const; - void _q_selectRow(int row); - void _q_selectColumn(int column); - void selectRow(int row, bool anchor); void selectColumn(int column, bool anchor); - void _q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end); - void _q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end); - void _q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end); - void _q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end); - void _q_sortIndicatorChanged(int column, Qt::SortOrder order); + void updateSpanInsertedRows(const QModelIndex &parent, int start, int end); + void updateSpanInsertedColumns(const QModelIndex &parent, int start, int end); + void updateSpanRemovedRows(const QModelIndex &parent, int start, int end); + void updateSpanRemovedColumns(const QModelIndex &parent, int start, int end); + void sortIndicatorChanged(int column, Qt::SortOrder order); }; QT_END_NAMESPACE diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp index 857d64b3dd..91e89fe9d3 100644 --- a/src/widgets/itemviews/qtablewidget.cpp +++ b/src/widgets/itemviews/qtablewidget.cpp @@ -1595,28 +1595,28 @@ void QTableWidgetPrivate::setup() connections = { // view signals QObjectPrivate::connect(q, &QTableWidget::pressed, - this, &QTableWidgetPrivate::_q_emitItemPressed), + this, &QTableWidgetPrivate::emitItemPressed), QObjectPrivate::connect(q, &QTableWidget::clicked, - this, &QTableWidgetPrivate::_q_emitItemClicked), + this, &QTableWidgetPrivate::emitItemClicked), QObjectPrivate::connect(q, &QTableWidget::doubleClicked, - this, &QTableWidgetPrivate::_q_emitItemDoubleClicked), + this, &QTableWidgetPrivate::emitItemDoubleClicked), QObjectPrivate::connect(q, &QTableWidget::activated, - this, &QTableWidgetPrivate::_q_emitItemActivated), + this, &QTableWidgetPrivate::emitItemActivated), QObjectPrivate::connect(q, &QTableWidget::entered, - this, &QTableWidgetPrivate::_q_emitItemEntered), + this, &QTableWidgetPrivate::emitItemEntered), // model signals QObjectPrivate::connect(model, &QAbstractItemModel::dataChanged, - this, &QTableWidgetPrivate::_q_emitItemChanged), + this, &QTableWidgetPrivate::emitItemChanged), // selection signals QObjectPrivate::connect(q->selectionModel(), &QItemSelectionModel::currentChanged, - this, &QTableWidgetPrivate::_q_emitCurrentItemChanged), + this, &QTableWidgetPrivate::emitCurrentItemChanged), QObject::connect(q->selectionModel(), &QItemSelectionModel::selectionChanged, q, &QTableWidget::itemSelectionChanged), // sorting QObjectPrivate::connect(model, &QAbstractItemModel::dataChanged, - this, &QTableWidgetPrivate::_q_dataChanged), + this, &QTableWidgetPrivate::dataChanged), QObjectPrivate::connect(model, &QAbstractItemModel::columnsRemoved, - this, &QTableWidgetPrivate::_q_sort) + this, &QTableWidgetPrivate::sort) }; } @@ -1626,7 +1626,7 @@ void QTableWidgetPrivate::clearConnections() QObject::disconnect(connection); } -void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index) +void QTableWidgetPrivate::emitItemPressed(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1634,7 +1634,7 @@ void QTableWidgetPrivate::_q_emitItemPressed(const QModelIndex &index) emit q->cellPressed(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index) +void QTableWidgetPrivate::emitItemClicked(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1642,7 +1642,7 @@ void QTableWidgetPrivate::_q_emitItemClicked(const QModelIndex &index) emit q->cellClicked(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index) +void QTableWidgetPrivate::emitItemDoubleClicked(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1650,7 +1650,7 @@ void QTableWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index) emit q->cellDoubleClicked(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index) +void QTableWidgetPrivate::emitItemActivated(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1658,7 +1658,7 @@ void QTableWidgetPrivate::_q_emitItemActivated(const QModelIndex &index) emit q->cellActivated(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index) +void QTableWidgetPrivate::emitItemEntered(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1666,7 +1666,7 @@ void QTableWidgetPrivate::_q_emitItemEntered(const QModelIndex &index) emit q->cellEntered(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitItemChanged(const QModelIndex &index) +void QTableWidgetPrivate::emitItemChanged(const QModelIndex &index) { Q_Q(QTableWidget); if (QTableWidgetItem *item = tableModel()->item(index)) @@ -1674,7 +1674,7 @@ void QTableWidgetPrivate::_q_emitItemChanged(const QModelIndex &index) emit q->cellChanged(index.row(), index.column()); } -void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex ¤t, +void QTableWidgetPrivate::emitCurrentItemChanged(const QModelIndex ¤t, const QModelIndex &previous) { Q_Q(QTableWidget); @@ -1685,7 +1685,7 @@ void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex ¤t, emit q->currentCellChanged(current.row(), current.column(), previous.row(), previous.column()); } -void QTableWidgetPrivate::_q_sort() +void QTableWidgetPrivate::sort() { if (sortingEnabled) { int column = horizontalHeader->sortIndicatorSection(); @@ -1694,8 +1694,8 @@ void QTableWidgetPrivate::_q_sort() } } -void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, - const QModelIndex &bottomRight) +void QTableWidgetPrivate::dataChanged(const QModelIndex &topLeft, + const QModelIndex &bottomRight) { if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()) { int column = horizontalHeader->sortIndicatorSection(); diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h index 714aac6b7b..210910fc52 100644 --- a/src/widgets/itemviews/qtablewidget_p.h +++ b/src/widgets/itemviews/qtablewidget_p.h @@ -155,18 +155,18 @@ public: void clearConnections(); // view signals - void _q_emitItemPressed(const QModelIndex &index); - void _q_emitItemClicked(const QModelIndex &index); - void _q_emitItemDoubleClicked(const QModelIndex &index); - void _q_emitItemActivated(const QModelIndex &index); - void _q_emitItemEntered(const QModelIndex &index); + void emitItemPressed(const QModelIndex &index); + void emitItemClicked(const QModelIndex &index); + void emitItemDoubleClicked(const QModelIndex &index); + void emitItemActivated(const QModelIndex &index); + void emitItemEntered(const QModelIndex &index); // model signals - void _q_emitItemChanged(const QModelIndex &index); + void emitItemChanged(const QModelIndex &index); // selection signals - void _q_emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex ¤t); + void emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex ¤t); // sorting - void _q_sort(); - void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void sort(); + void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); std::array connections; };