Changes to Qt SerialBus

Qt 6 is a result of the conscious effort to make the framework more efficient and easy to use. We try to maintain binary and source compatibility for all the public APIs in each release. But some changes were inevitable in an effort to make Qt a better framework. In this topic, we summarize those changes in Qt SerialBus module and provide guidance to handle them.

Changes overview

The Qt SerialBus module is generally speaking source compatible with the Qt 5 version and users of the library should be able to continue with no or minor changes to their project.

Build system

As with Qt 6 in general, the Qt SerialBus module has CMake support in addition to qmake.

API changes

Qt CAN bus

Removal of QCanBusFactoryV2

In Qt 6 the QCanBusFactoryV2 has been removed and is no longer part of the public API. Instead QCanBusFactory has gained the additional method QCanBusFactory::availableDevices that needs to be implemented by sub-classes of QCanBusFactory.

Changes to QCanBusDevice

QCanBusDevice got the following changes:

  • setConfigurationParameter() and configurationParameter() now use the distinct type ConfigurationKey instead int.
  • The functions resetController(), hasBusStatus() and busStatus() are now virtual functions. They have been internal callbacks in Qt 5 due to binary compatibility.
  • Custom plugins using one of the private API function QCanBusDevice::createDeviceInfo() need small adoptions as these functions now have the plugin name as first parameter and slighly adopted parameter lists.

Changes to QCanBusFrame

QCanBusFrame now uses the distinct type FrameId, which is a typedef to quint32, so existing code should still work. Anyway, it is recommended to use FrameId when upgrading.

Qt Modbus

Renaming of QModbusRtuSerialMaster and QModbusRtuSerialSlave

Following the recommendation of the Modbus organization the class QModbusRtuSerialMaster has been renamed to QModbusRtuSerialClient and the class QModbusRtuSerialSlave has been renamed to QModbusRtuSerialServer. It is advised to use the new class names in new or ported code to adhere to the Modbus naming scheme.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.