libinput: Pass QStrings as constref

This commit is contained in:
Aleix Pol 2021-11-04 20:16:36 +01:00 committed by Aleix Pol Gonzalez
parent 7c6b0d9ef4
commit eaa2f538e3
2 changed files with 5 additions and 5 deletions

View file

@ -121,7 +121,7 @@ struct ConfigData {
: key(_key)
{ quint32Setter.setter = _setter; quint32Setter.defaultValue = _defaultValue; }
explicit ConfigData(QByteArray _key, void (Device::*_setter)(QString), QString (Device::*_defaultValue)() const = nullptr)
explicit ConfigData(QByteArray _key, void (Device::*_setter)(const QString&), QString (Device::*_defaultValue)() const = nullptr)
: key(_key)
{ stringSetter.setter = _setter; stringSetter.defaultValue = _defaultValue; }
@ -153,7 +153,7 @@ struct ConfigData {
quint32 (Device::*defaultValue)() const;
} quint32Setter;
struct {
void (Device::*setter)(QString) = nullptr;
void (Device::*setter)(const QString&) = nullptr;
QString (Device::*defaultValue)() const;
} stringSetter;
struct {
@ -660,7 +660,7 @@ void Device::setOrientation(Qt::ScreenOrientation orientation)
}
}
void Device::setOutputName(QString name)
void Device::setOutputName(const QString &name)
{
#ifndef KWIN_BUILD_TESTING
if (name.isEmpty()) {

View file

@ -384,7 +384,7 @@ public:
* @param acceleration mapped to range [-1,1] with -1 being the slowest, 1 being the fastest supported acceleration.
*/
void setPointerAcceleration(qreal acceleration);
void setPointerAccelerationFromString(QString acceleration) {
void setPointerAccelerationFromString(const QString &acceleration) {
setPointerAcceleration(acceleration.toDouble());
}
QString defaultPointerAccelerationToString() const {
@ -473,7 +473,7 @@ public:
/**
* Used to deserialize monitor data from KConfig when initializing a device
*/
void setOutputName(QString uuid);
void setOutputName(const QString &uuid);
QString defaultOutputName() const
{
return {};