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 = new FrameSvgItemMargins(m_frameSvg, this);
m_fixedMargins->setFixed(true); m_fixedMargins->setFixed(true);
setFlag(ItemHasContents, 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(&Units::instance(), &Units::devicePixelRatioChanged, this, &FrameSvgItem::updateDevicePixelRatio);
connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged); connect(m_frameSvg, &Svg::fromCurrentThemeChanged, this, &FrameSvgItem::fromCurrentThemeChanged);
connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged); connect(m_frameSvg, &Svg::statusChanged, this, &FrameSvgItem::statusChanged);

View File

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

View File

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

View File

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

View File

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