Use new connect syntax in more places

Especially in frequently created items. Shoves off a couple of milliseconds of startup time.

Differential Revision: https://phabricator.kde.org/D6614
This commit is contained in:
Kai Uwe Broulik 2017-07-10 22:24:50 +02:00
parent a19701c252
commit c00069c43d
5 changed files with 16 additions and 17 deletions

View File

@ -263,7 +263,7 @@ FrameSvgItem::FrameSvgItem(QQuickItem *parent)
m_fixedMargins = new FrameSvgItemMargins(m_frameSvg, this);
m_fixedMargins->setFixed(true);
setFlag(ItemHasContents, true);
connect(m_frameSvg, SIGNAL(repaintNeeded()), this, SLOT(doUpdate()));
connect(m_frameSvg, &FrameSvg::repaintNeeded, this, &FrameSvgItem::doUpdate);
connect(&Units::instance(), &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged);
connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged);

View File

@ -54,10 +54,10 @@ IconItem::IconItem(QQuickItem *parent)
m_animValue(0)
{
m_animation = new QPropertyAnimation(this);
connect(m_animation, SIGNAL(valueChanged(QVariant)),
this, SLOT(valueChanged(QVariant)));
connect(m_animation, SIGNAL(finished()),
this, SLOT(animationFinished()));
connect(m_animation, &QPropertyAnimation::valueChanged,
this, &IconItem::valueChanged);
connect(m_animation, &QPropertyAnimation::finished,
this, &IconItem::animationFinished);
m_animation->setTargetObject(this);
m_animation->setEasingCurve(QEasingCurve::InOutQuad);
m_animation->setDuration(250); //FIXME from theme
@ -73,8 +73,8 @@ IconItem::IconItem(QQuickItem *parent)
connect(this, &QQuickItem::windowChanged,
this, &IconItem::schedulePixmapUpdate);
connect(this, SIGNAL(overlaysChanged()),
this, SLOT(schedulePixmapUpdate()));
connect(this, &IconItem::overlaysChanged,
this, &IconItem::schedulePixmapUpdate);
connect(this, &IconItem::implicitWidthChanged, this, &IconItem::implicitWidthChanged2);
connect(this, &IconItem::implicitHeightChanged, this, &IconItem::implicitHeightChanged2);

View File

@ -92,9 +92,9 @@ void SvgItem::setSvg(Plasma::Svg *svg)
updateDevicePixelRatio();
if (svg) {
connect(svg, SIGNAL(repaintNeeded()), this, SLOT(updateNeeded()));
connect(svg, SIGNAL(repaintNeeded()), this, SIGNAL(naturalSizeChanged()));
connect(svg, SIGNAL(sizeChanged()), this, SIGNAL(naturalSizeChanged()));
connect(svg, &Svg::repaintNeeded, this, &SvgItem::updateNeeded);
connect(svg, &Svg::repaintNeeded, this, &SvgItem::naturalSizeChanged);
connect(svg, &Svg::sizeChanged, this, &SvgItem::naturalSizeChanged);
}
if (implicitWidth() <= 0) {

View File

@ -452,11 +452,11 @@ void AppletInterface::setAction(const QString &name, const QString &text, const
if (!m_actionSignals) {
m_actionSignals = new QSignalMapper(this);
connect(m_actionSignals, SIGNAL(mapped(QString)),
appletScript(), SLOT(executeAction(QString)));
connect(m_actionSignals, static_cast<void(QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
appletScript(), &DeclarativeAppletScript::executeAction);
}
connect(action, SIGNAL(triggered()), m_actionSignals, SLOT(map()));
connect(action, &QAction::triggered, m_actionSignals, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map));
m_actionSignals->setMapping(action, name);
}

View File

@ -222,11 +222,10 @@ void WallpaperInterface::setAction(const QString &name, const QString &text, con
if (!m_actionSignals) {
m_actionSignals = new QSignalMapper(this);
connect(m_actionSignals, SIGNAL(mapped(QString)),
this, SLOT(executeAction(QString)));
connect(m_actionSignals, static_cast<void(QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
this, &WallpaperInterface::executeAction);
}
connect(action, SIGNAL(triggered()), m_actionSignals, SLOT(map()));
connect(action, &QAction::triggered, m_actionSignals, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map));
m_actionSignals->setMapping(action, name);
}