QTableView/Widget: rename private functions (remove _q_ prefix)

Cleanup the private function names after the change to pmf-style
connections.

Task-number: QTBUG-117698
Change-Id: I60275b7da6bf5e78562ccfd38a02719cc313eb49
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-09-30 19:28:20 +02:00
parent 3ad6bdcc62
commit 03b437bbad
4 changed files with 47 additions and 60 deletions

View File

@ -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);

View File

@ -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

View File

@ -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 &current,
void QTableWidgetPrivate::emitCurrentItemChanged(const QModelIndex &current,
const QModelIndex &previous)
{
Q_Q(QTableWidget);
@ -1685,7 +1685,7 @@ void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
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();

View File

@ -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 &current);
void emitCurrentItemChanged(const QModelIndex &previous, const QModelIndex &current);
// 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<QMetaObject::Connection, 10> connections;
};