diff options
author | Andre Hartmann <aha_1980@gmx.de> | 2021-01-06 19:00:57 +0100 |
---|---|---|
committer | Andre Hartmann <aha_1980@gmx.de> | 2021-02-03 14:57:12 +0100 |
commit | 227060f8c17aaf90fe542ad6079a6badaf410a0d (patch) | |
tree | 4c6e441c846a199a4e436f0a4fea07eeca9fa292 /src/plugins/canbus/systeccan/systeccanbackend.cpp | |
parent | c990bdbf8ec922dd7702a2a0e33b9b70db3ac6ee (diff) |
QCanBusDevice: Replace int parameter with ConfigurationKey
They only place where this might break user code,
is for custom plugins using custom configuration
parameters.
For most users however, this type safety makes the
API easier to use.
[ChangeLog][QCanBusDevice]
All functions dealing with configuration parameters
now take a QCanBusDevice::ConfigurationKey instead
an int.
Fixes: QTBUG-89839
Change-Id: I0a1de5fdcfc4292b23599d4770102740a2df1601
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/plugins/canbus/systeccan/systeccanbackend.cpp')
-rw-r--r-- | src/plugins/canbus/systeccan/systeccanbackend.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/canbus/systeccan/systeccanbackend.cpp b/src/plugins/canbus/systeccan/systeccanbackend.cpp index 06df8e9..c1520a5 100644 --- a/src/plugins/canbus/systeccan/systeccanbackend.cpp +++ b/src/plugins/canbus/systeccan/systeccanbackend.cpp @@ -251,7 +251,8 @@ void SystecCanBackendPrivate::eventHandler(QEvent *event) readAllReceivedMessages(); } -bool SystecCanBackendPrivate::setConfigurationParameter(int key, const QVariant &value) +bool SystecCanBackendPrivate::setConfigurationParameter(QCanBusDevice::ConfigurationKey key, + const QVariant &value) { Q_Q(SystecCanBackend); @@ -517,8 +518,8 @@ bool SystecCanBackend::open() // Apply all stored configurations except bitrate and receive own, // because these cannot be applied after opening the device - const QList<int> keys = configurationKeys(); - for (int key : keys) { + const auto keys = configurationKeys(); + for (ConfigurationKey key : keys) { if (key == BitRateKey || key == ReceiveOwnKey) continue; const QVariant param = configurationParameter(key); @@ -542,7 +543,7 @@ void SystecCanBackend::close() setState(QCanBusDevice::UnconnectedState); } -void SystecCanBackend::setConfigurationParameter(int key, const QVariant &value) +void SystecCanBackend::setConfigurationParameter(ConfigurationKey key, const QVariant &value) { Q_D(SystecCanBackend); |