From 35ed524d9226cb705081737652d72d5cbb86e6c6 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 30 Aug 2017 12:32:29 +0200 Subject: evdev*,libinput: use functor-based connections This results in less boilerplate code, among other benefits that come with functor-based connections. Simple expressions have been converted to use lambda. Change-Id: I6887980524027eada24beed95e6f9ba43f0fc8d5 Reviewed-by: Laszlo Agocs --- src/platformsupport/input/libinput/qlibinputhandler.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/platformsupport/input/libinput/qlibinputhandler.cpp') diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp index 961eb3539f..142492ff02 100644 --- a/src/platformsupport/input/libinput/qlibinputhandler.cpp +++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp @@ -107,14 +107,17 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec) m_liFd = libinput_get_fd(m_li); m_notifier.reset(new QSocketNotifier(m_liFd, QSocketNotifier::Read)); - connect(m_notifier.data(), SIGNAL(activated(int)), SLOT(onReadyRead())); + + connect(m_notifier.data(), &QSocketNotifier::activated, this, &QLibInputHandler::onReadyRead); m_pointer.reset(new QLibInputPointer); m_keyboard.reset(new QLibInputKeyboard); m_touch.reset(new QLibInputTouch); - connect(QGuiApplicationPrivate::inputDeviceManager(), SIGNAL(cursorPositionChangeRequested(QPoint)), - this, SLOT(onCursorPositionChangeRequested(QPoint))); + QInputDeviceManager *manager = QGuiApplicationPrivate::inputDeviceManager(); + connect(manager, &QInputDeviceManager::cursorPositionChangeRequested, [=](const QPoint &pos) { + m_pointer->setPos(pos); + }); // Process the initial burst of DEVICE_ADDED events. onReadyRead(); @@ -236,9 +239,4 @@ void QLibInputHandler::processEvent(libinput_event *ev) } } -void QLibInputHandler::onCursorPositionChangeRequested(const QPoint &pos) -{ - m_pointer->setPos(pos); -} - QT_END_NAMESPACE -- cgit v1.2.3