QAbstractItem/Column/TreeView: rename private functions (remove _q_ prefix)

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

Task-number: QTBUG-117698
Change-Id: Id15ef245cacca9c00bf65271bccf4da82fb7fd2f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Christian Ehrlicher 2023-09-30 19:43:27 +02:00
parent 81e53db238
commit 011d71664b
6 changed files with 75 additions and 75 deletions

View File

@ -175,7 +175,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index
#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
// stores and restores the selection and current item when flicking
void QAbstractItemViewPrivate::_q_scrollerStateChanged()
void QAbstractItemViewPrivate::scrollerStateChanged()
{
Q_Q(QAbstractItemView);
@ -211,7 +211,7 @@ void QAbstractItemViewPrivate::_q_scrollerStateChanged()
#endif // QT_NO_GESTURES
void QAbstractItemViewPrivate::_q_delegateSizeHintChanged(const QModelIndex &index)
void QAbstractItemViewPrivate::delegateSizeHintChanged(const QModelIndex &index)
{
Q_Q(QAbstractItemView);
if (model) {
@ -231,7 +231,7 @@ void QAbstractItemViewPrivate::connectDelegate(QAbstractItemDelegate *delegate)
QObject::connect(delegate, &QAbstractItemDelegate::commitData,
q, &QAbstractItemView::commitData);
QObjectPrivate::connect(delegate, &QAbstractItemDelegate::sizeHintChanged,
this, &QAbstractItemViewPrivate::_q_delegateSizeHintChanged);
this, &QAbstractItemViewPrivate::delegateSizeHintChanged);
}
void QAbstractItemViewPrivate::disconnectDelegate(QAbstractItemDelegate *delegate)
@ -244,7 +244,7 @@ void QAbstractItemViewPrivate::disconnectDelegate(QAbstractItemDelegate *delegat
QObject::disconnect(delegate, &QAbstractItemDelegate::commitData,
q, &QAbstractItemView::commitData);
QObjectPrivate::disconnect(delegate, &QAbstractItemDelegate::sizeHintChanged,
this, &QAbstractItemViewPrivate::_q_delegateSizeHintChanged);
this, &QAbstractItemViewPrivate::delegateSizeHintChanged);
}
void QAbstractItemViewPrivate::disconnectAll()
@ -728,33 +728,33 @@ void QAbstractItemView::setModel(QAbstractItemModel *model)
if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
d->modelConnections = {
QObjectPrivate::connect(d->model, &QAbstractItemModel::destroyed,
d, &QAbstractItemViewPrivate::_q_modelDestroyed),
d, &QAbstractItemViewPrivate::modelDestroyed),
QObject::connect(d->model, &QAbstractItemModel::dataChanged,
this, &QAbstractItemView::dataChanged),
QObjectPrivate::connect(d->model, &QAbstractItemModel::headerDataChanged,
d, &QAbstractItemViewPrivate::_q_headerDataChanged),
d, &QAbstractItemViewPrivate::headerDataChanged),
QObject::connect(d->model, &QAbstractItemModel::rowsInserted,
this, &QAbstractItemView::rowsInserted),
QObjectPrivate::connect(d->model, &QAbstractItemModel::rowsInserted,
d, &QAbstractItemViewPrivate::_q_rowsInserted),
d, &QAbstractItemViewPrivate::rowsInserted),
QObject::connect(d->model, &QAbstractItemModel::rowsAboutToBeRemoved,
this, &QAbstractItemView::rowsAboutToBeRemoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::rowsRemoved,
d, &QAbstractItemViewPrivate::_q_rowsRemoved),
d, &QAbstractItemViewPrivate::rowsRemoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::rowsMoved,
d, &QAbstractItemViewPrivate::_q_rowsMoved),
d, &QAbstractItemViewPrivate::rowsMoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::columnsAboutToBeRemoved,
d, &QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved),
d, &QAbstractItemViewPrivate::columnsAboutToBeRemoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::columnsRemoved,
d, &QAbstractItemViewPrivate::_q_columnsRemoved),
d, &QAbstractItemViewPrivate::columnsRemoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::columnsInserted,
d, &QAbstractItemViewPrivate::_q_columnsInserted),
d, &QAbstractItemViewPrivate::columnsInserted),
QObjectPrivate::connect(d->model, &QAbstractItemModel::columnsMoved,
d, &QAbstractItemViewPrivate::_q_columnsMoved),
d, &QAbstractItemViewPrivate::columnsMoved),
QObject::connect(d->model, &QAbstractItemModel::modelReset,
this, &QAbstractItemView::reset),
QObjectPrivate::connect(d->model, &QAbstractItemModel::layoutChanged,
d, &QAbstractItemViewPrivate::_q_layoutChanged),
d, &QAbstractItemViewPrivate::layoutChanged),
};
}
@ -1789,7 +1789,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event)
#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
d->scollerConnection = QObjectPrivate::connect(
QScroller::scroller(d->viewport), &QScroller::stateChanged,
d, &QAbstractItemViewPrivate::_q_scrollerStateChanged,
d, &QAbstractItemViewPrivate::scrollerStateChanged,
Qt::UniqueConnection);
#endif
break;
@ -3547,7 +3547,7 @@ void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int star
rows are those under the given \a parent from \a start to \a end
inclusive.
*/
void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end)
void QAbstractItemViewPrivate::rowsRemoved(const QModelIndex &index, int start, int end)
{
Q_UNUSED(index);
Q_UNUSED(start);
@ -3575,7 +3575,7 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star
columns are those under the given \a parent from \a start to \a end
inclusive.
*/
void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
void QAbstractItemViewPrivate::columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
Q_Q(QAbstractItemView);
@ -3638,7 +3638,7 @@ void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &par
rows are those under the given \a parent from \a start to \a end
inclusive.
*/
void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end)
void QAbstractItemViewPrivate::columnsRemoved(const QModelIndex &index, int start, int end)
{
Q_UNUSED(index);
Q_UNUSED(start);
@ -3665,7 +3665,7 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s
This slot is called when rows have been inserted.
*/
void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end)
void QAbstractItemViewPrivate::rowsInserted(const QModelIndex &index, int start, int end)
{
Q_UNUSED(index);
Q_UNUSED(start);
@ -3688,7 +3688,7 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta
This slot is called when columns have been inserted.
*/
void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end)
void QAbstractItemViewPrivate::columnsInserted(const QModelIndex &index, int start, int end)
{
Q_UNUSED(index);
Q_UNUSED(start);
@ -3711,7 +3711,7 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int
/*!
\internal
*/
void QAbstractItemViewPrivate::_q_modelDestroyed()
void QAbstractItemViewPrivate::modelDestroyed()
{
model = QAbstractItemModelPrivate::staticEmptyModel();
doDelayedReset();
@ -3722,7 +3722,7 @@ void QAbstractItemViewPrivate::_q_modelDestroyed()
This slot is called when the layout is changed.
*/
void QAbstractItemViewPrivate::_q_layoutChanged()
void QAbstractItemViewPrivate::layoutChanged()
{
doDelayedItemsLayout();
#if QT_CONFIG(accessibility)
@ -3734,14 +3734,14 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
#endif
}
void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
void QAbstractItemViewPrivate::rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
{
_q_layoutChanged();
layoutChanged();
}
void QAbstractItemViewPrivate::_q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
void QAbstractItemViewPrivate::columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int)
{
_q_layoutChanged();
layoutChanged();
}
QRect QAbstractItemViewPrivate::intersectedRect(const QRect rect, const QModelIndex &topLeft, const QModelIndex &bottomRight) const

View File

@ -65,20 +65,20 @@ public:
void init();
virtual void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_rowsInserted(const QModelIndex &parent, int start, int end);
virtual void _q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsRemoved(const QModelIndex &parent, int start, int end);
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
virtual void _q_modelDestroyed();
virtual void _q_layoutChanged();
virtual void _q_rowsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
virtual void _q_columnsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
virtual void rowsRemoved(const QModelIndex &parent, int start, int end);
virtual void rowsInserted(const QModelIndex &parent, int start, int end);
virtual void columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
virtual void columnsRemoved(const QModelIndex &parent, int start, int end);
virtual void columnsInserted(const QModelIndex &parent, int start, int end);
virtual void modelDestroyed();
virtual void layoutChanged();
virtual void rowsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
virtual void columnsMoved(const QModelIndex &source, int sourceStart, int sourceEnd, const QModelIndex &destination, int destinationStart);
virtual QRect intersectedRect(const QRect rect, const QModelIndex &topLeft, const QModelIndex &bottomRight) const;
void _q_headerDataChanged() { doDelayedItemsLayout(); }
void _q_scrollerStateChanged();
void _q_delegateSizeHintChanged(const QModelIndex &index);
void headerDataChanged() { doDelayedItemsLayout(); }
void scrollerStateChanged();
void delegateSizeHintChanged(const QModelIndex &index);
void fetchMore();
@ -317,7 +317,7 @@ public:
{
//we delay the reset of the timer because some views (QTableView)
//with headers can't handle the fact that the model has been destroyed
//all _q_modelDestroyed slots must have been called
//all modelDestroyed() slots must have been called
if (!delayedReset.isActive())
delayedReset.start(0, q_func());
}

View File

@ -70,7 +70,7 @@ void QColumnViewPrivate::initialize()
#if QT_CONFIG(animation)
animationConnection =
QObjectPrivate::connect(&currentAnimation, &QPropertyAnimation::finished,
this, &QColumnViewPrivate::_q_changeCurrentColumn);
this, &QColumnViewPrivate::changeCurrentColumn);
currentAnimation.setTargetObject(hbar);
currentAnimation.setPropertyName("value");
currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);
@ -122,7 +122,7 @@ void QColumnView::setResizeGripsVisible(bool visible)
view->setCornerWidget(grip);
d->gripConnections.push_back(
QObjectPrivate::connect(grip, &QColumnViewGrip::gripMoved,
d, &QColumnViewPrivate::_q_gripMoved)
d, &QColumnViewPrivate::gripMoved)
);
} else {
QWidget *widget = view->cornerWidget();
@ -287,7 +287,7 @@ void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)
if (leftEdge > -horizontalOffset()
&& rightEdge <= ( -horizontalOffset() + viewport()->size().width())) {
d->columns.at(indexColumn)->scrollTo(index);
d->_q_changeCurrentColumn();
d->changeCurrentColumn();
return;
}
@ -506,7 +506,7 @@ QSize QColumnView::sizeHint() const
\internal
Move all widgets from the corner grip and to the right
*/
void QColumnViewPrivate::_q_gripMoved(int offset)
void QColumnViewPrivate::gripMoved(int offset)
{
Q_Q(QColumnView);
@ -630,7 +630,7 @@ void QColumnViewPrivate::disconnectView(QAbstractItemView *view)
viewConnections.erase(it);
}
void QColumnViewPrivate::_q_clicked(const QModelIndex &index)
void QColumnViewPrivate::clicked(const QModelIndex &index)
{
Q_Q(QColumnView);
QModelIndex parent = index.parent();
@ -668,7 +668,7 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
view = q->createColumn(index);
connections.push_back(
QObjectPrivate::connect(view, &QAbstractItemView::clicked,
this, &QColumnViewPrivate::_q_clicked));
this, &QColumnViewPrivate::clicked));
} else {
if (!previewColumn)
setPreviewWidget(new QWidget(q));
@ -699,7 +699,7 @@ QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bo
view->setCornerWidget(grip);
gripConnections.push_back(
QObjectPrivate::connect(grip, &QColumnViewGrip::gripMoved,
this, &QColumnViewPrivate::_q_gripMoved)
this, &QColumnViewPrivate::gripMoved)
);
}
@ -954,7 +954,7 @@ void QColumnView::currentChanged(const QModelIndex &current, const QModelIndex &
We have change the current column and need to update focus and selection models
on the new current column.
*/
void QColumnViewPrivate::_q_changeCurrentColumn()
void QColumnViewPrivate::changeCurrentColumn()
{
Q_Q(QColumnView);
if (columns.isEmpty())
@ -1061,9 +1061,9 @@ QColumnViewPrivate::~QColumnViewPrivate()
\internal
*/
void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end)
void QColumnViewPrivate::columnsInserted(const QModelIndex &parent, int start, int end)
{
QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end);
QAbstractItemViewPrivate::columnsInserted(parent, start, end);
checkColumnCreation(parent);
}

View File

@ -130,10 +130,10 @@ public:
void checkColumnCreation(const QModelIndex &parent);
void _q_gripMoved(int offset);
void _q_changeCurrentColumn();
void _q_clicked(const QModelIndex &index);
void _q_columnsInserted(const QModelIndex &parent, int start, int end) override;
void gripMoved(int offset);
void changeCurrentColumn();
void clicked(const QModelIndex &index);
void columnsInserted(const QModelIndex &parent, int start, int end) override;
QList<QAbstractItemView*> columns;
QList<int> columnSizes; // used during init and corner moving

View File

@ -200,21 +200,21 @@ void QTreeView::setModel(QAbstractItemModel *model)
if (d->model) {
// QAbstractItemView connects to a private slot
QObjectPrivate::disconnect(d->model, &QAbstractItemModel::rowsRemoved,
d, &QAbstractItemViewPrivate::_q_rowsRemoved);
d, &QAbstractItemViewPrivate::rowsRemoved);
// do header layout after the tree
QObjectPrivate::disconnect(d->model, &QAbstractItemModel::layoutChanged,
d->header->d_func(), &QAbstractItemViewPrivate::_q_layoutChanged);
d->header->d_func(), &QAbstractItemViewPrivate::layoutChanged);
d->modelConnections = {
// QTreeView has a public slot for this
QObject::connect(d->model, &QAbstractItemModel::rowsRemoved,
this, &QTreeView::rowsRemoved),
QObjectPrivate::connect(d->model, &QAbstractItemModel::modelAboutToBeReset,
d, &QTreeViewPrivate::_q_modelAboutToBeReset)
d, &QTreeViewPrivate::modelAboutToBeReset)
};
}
if (d->sortingEnabled)
d->_q_sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
d->sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
}
/*!
@ -843,7 +843,7 @@ void QTreeView::setSortingEnabled(bool enable)
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
d->sortHeaderConnection =
QObjectPrivate::connect(header(), &QHeaderView::sortIndicatorChanged,
d, &QTreeViewPrivate::_q_sortIndicatorChanged,
d, &QTreeViewPrivate::sortIndicatorChanged,
Qt::UniqueConnection);
} else {
QObject::disconnect(d->sortHeaderConnection);
@ -1399,12 +1399,12 @@ bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos)
return false;
}
void QTreeViewPrivate::_q_modelDestroyed()
void QTreeViewPrivate::modelDestroyed()
{
//we need to clear the viewItems because it contains QModelIndexes to
//the model currently being destroyed
viewItems.clear();
QAbstractItemViewPrivate::_q_modelDestroyed();
QAbstractItemViewPrivate::modelDestroyed();
}
QRect QTreeViewPrivate::intersectedRect(const QRect rect, const QModelIndex &topLeft, const QModelIndex &bottomRight) const
@ -2583,7 +2583,7 @@ void QTreeView::rowsRemoved(const QModelIndex &parent, int start, int end)
d->viewItems.clear();
d->doDelayedItemsLayout();
d->hasRemovedItems = true;
d->_q_rowsRemoved(parent, start, end);
d->rowsRemoved(parent, start, end);
}
/*!
@ -3093,7 +3093,7 @@ void QTreeViewPrivate::initialize()
animationsEnabled = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, q) > 0;
animationConnection =
QObjectPrivate::connect(&animatedOperation, &QVariantAnimation::finished,
this, &QTreeViewPrivate::_q_endAnimatedOperation);
this, &QTreeViewPrivate::endAnimatedOperation);
#endif // animation
}
@ -3322,7 +3322,7 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
return pixmap;
}
void QTreeViewPrivate::_q_endAnimatedOperation()
void QTreeViewPrivate::endAnimatedOperation()
{
Q_Q(QTreeView);
q->setState(stateBeforeAnimation);
@ -3331,23 +3331,23 @@ void QTreeViewPrivate::_q_endAnimatedOperation()
}
#endif // animation
void QTreeViewPrivate::_q_modelAboutToBeReset()
void QTreeViewPrivate::modelAboutToBeReset()
{
viewItems.clear();
}
void QTreeViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
void QTreeViewPrivate::columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
{
if (start <= 0 && 0 <= end)
viewItems.clear();
QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(parent, start, end);
QAbstractItemViewPrivate::columnsAboutToBeRemoved(parent, start, end);
}
void QTreeViewPrivate::_q_columnsRemoved(const QModelIndex &parent, int start, int end)
void QTreeViewPrivate::columnsRemoved(const QModelIndex &parent, int start, int end)
{
if (start <= 0 && 0 <= end)
doDelayedItemsLayout();
QAbstractItemViewPrivate::_q_columnsRemoved(parent, start, end);
QAbstractItemViewPrivate::columnsRemoved(parent, start, end);
}
/** \internal
@ -4020,7 +4020,7 @@ bool QTreeViewPrivate::hasVisibleChildren(const QModelIndex& parent) const
return false;
}
void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order)
void QTreeViewPrivate::sortIndicatorChanged(int column, Qt::SortOrder order)
{
model->sort(column, order);
}

View File

@ -91,17 +91,17 @@ public:
void beginAnimatedOperation();
void drawAnimatedOperation(QPainter *painter) const;
QPixmap renderTreeToPixmapForAnimation(const QRect &rect) const;
void _q_endAnimatedOperation();
void endAnimatedOperation();
#endif // animation
void expand(int item, bool emitSignal);
void collapse(int item, bool emitSignal);
void _q_columnsAboutToBeRemoved(const QModelIndex &, int, int) override;
void _q_columnsRemoved(const QModelIndex &, int, int) override;
void _q_modelAboutToBeReset();
void _q_sortIndicatorChanged(int column, Qt::SortOrder order);
void _q_modelDestroyed() override;
void columnsAboutToBeRemoved(const QModelIndex &, int, int) override;
void columnsRemoved(const QModelIndex &, int, int) override;
void modelAboutToBeReset();
void sortIndicatorChanged(int column, Qt::SortOrder order);
void modelDestroyed() override;
QRect intersectedRect(const QRect rect, const QModelIndex &topLeft, const QModelIndex &bottomRight) const override;
void layout(int item, bool recusiveExpanding = false, bool afterIsUninitialized = false);