Skip to content

Commit

Permalink
Widgets: use pmf-style connect
Browse files Browse the repository at this point in the history
Use pmf-style connect for some easy-to-convert connections.

Change-Id: Id0a9d3465b2dfe5966374194a72980a67e978fe8
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Axel Spoerl <[email protected]>
  • Loading branch information
chehrlic committed Nov 4, 2023
1 parent 05d69ad commit 6780195
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/widgets/widgets/qeffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void QAlphaWidget::run(int time)
qApp->installEventFilter(this);
widget->setWindowOpacity(0.0);
widget->show();
connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
connect(&anim, &QTimer::timeout, this, &QAlphaWidget::render);
anim.start(1);
#else
//This is roughly equivalent to calling setVisible(true) without actually showing the widget
Expand All @@ -138,7 +138,7 @@ void QAlphaWidget::run(int time)
show();
setEnabled(false);

connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
connect(&anim, &QTimer::timeout, this, &QAlphaWidget::render);
anim.start(1);
} else {
duration = 0;
Expand Down Expand Up @@ -428,7 +428,7 @@ void QRollEffect::run(int time)
duration = qMin(qMax(dist/3, 50), 120);
}

connect(&anim, SIGNAL(timeout()), this, SLOT(scroll()));
connect(&anim, &QTimer::timeout, this, &QRollEffect::scroll);

move(widget->geometry().x(),widget->geometry().y());
resize(qMin(currentWidth, totalWidth), qMin(currentHeight, totalHeight));
Expand Down
6 changes: 4 additions & 2 deletions src/widgets/widgets/qstackedwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,10 @@ QStackedWidget::QStackedWidget(QWidget *parent)
{
Q_D(QStackedWidget);
d->layout = new QStackedLayout(this);
connect(d->layout, SIGNAL(widgetRemoved(int)), this, SIGNAL(widgetRemoved(int)));
connect(d->layout, SIGNAL(currentChanged(int)), this, SIGNAL(currentChanged(int)));
connect(d->layout, &QStackedLayout::widgetRemoved,
this, &QStackedWidget::widgetRemoved);
connect(d->layout, &QStackedLayout::currentChanged,
this, &QStackedWidget::currentChanged);
}

/*!
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/widgets/qstatusbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ void QStatusBar::showMessage(const QString &message, int timeout)
if (timeout > 0) {
if (!d->timer) {
d->timer = new QTimer(this);
connect(d->timer, SIGNAL(timeout()), this, SLOT(clearMessage()));
connect(d->timer, &QTimer::timeout, this, &QStatusBar::clearMessage);
}
d->timer->start(timeout);
} else if (d->timer) {
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/widgets/qwidgetanimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, boo
anim->setEasingCurve(QEasingCurve::InOutQuad);
anim->setEndValue(final_geometry);
m_animation_map[widget] = anim;
connect(anim, SIGNAL(finished()), SLOT(animationFinished()));
connect(anim, &QPropertyAnimation::finished,
this, &QWidgetAnimator::animationFinished);
anim->start(QPropertyAnimation::DeleteWhenStopped);
} else
#endif // animation
Expand Down

0 comments on commit 6780195

Please sign in to comment.