Learn what it takes for your microcontroller to communicate with QML Viewer and how to use the Serial Port. Demos and Examples; Video. Serial to QML Communication.
Contents • • • • • • • • • • • • • • • • NOTE: As of Qt 5.1, Qt Serial Port is now officially part of Qt. You no longer need to build Qt Serial Port manually; simply install Qt 5.1 or later and go to section Brief description The module is an add-on module for the Qt5 library, providing a single interface for both hardware and virtual serial ports. Note: Also added support for Qt4. Serial interfaces, due to their simplicity and reliability, are still popular in some industries like the development of embedded systems, robotics, etc. Using the module, developers can significantly reduce the time needed to implement Qt applications that require access to a serial interface.
Functionality Currently, the module API contains two classes: and. QSerialPort is the base class of the module and provides a set of basic methods and properties to access resources on serial ports. Supports the following operating systems: Operating system Support state Note Windows XP/Vista/7/8/10 YES Full support Windows CE NO (since 5.7) Tested only on 5 and 6 platforms in the emulator Gnu/Linux YES Full support MacOSX YES Full support Others Unix YES All POSIX-compatible Non-official partial Android Support (on own risk, only for rooted devices, in which is it possible to get/set a permissions to the /dev/ttyXYZ nodes). QSerialPortInfo is a helper class. It provides information on the available serial ports on the system. Supports the following operating systems: Operating system Support state Note Windows XP/Vista/7/8/10 YES Full support (using SetupAPI) Windows CE NO (since 5.7) Tested only on 5 and 6 platforms in the emulator Gnu/Linux YES Full support (using libudev, sysfs or simple search in /dev) MacOSX YES Full support Others Unix YES All POSIX-compatible (only simple search in /dev) Getting the source code You should clone from the and track changes from there in order to keep the load on Gerrit down.
$ git branch -a Building and Installing There are two simple methods to compile and install library using the command line or the. Before building you need to install Perl. Note: Perl is required only in the case of Qt5, see.
When using Qt4 just skip this point. Build and install from command line Note: ensure that the environment variables are set correctly: • correctly specified the path to the installed Qt4/Qt5 • correctly specified the path to use the compiler • correctly specified the path to Perl The following are the recommended steps for building the library for Qt4/Qt5 from the command line.
$ nmake $ nmake install Build and install from QtCreator Using is the simplest and fastest way to manually install the library. Before building you need to check that the desired toolchains (kits) of have been correctly configured. Recommended steps to build the library for Qt4/Qt5 from: • download and unpack the sources • run and open the root 'qtserialport/qtserialport.pro' project file • get to 'Projects->(Your Kit)->Build->Build Steps' • add a new make 'Build Step' and write to the 'Make arguments' the install target • from the menus, select 'Rebuild Project qtserialport' As a result, the library will be automatically compiled and installed into the desired Qt instance (according to the selected Kit). Note: on unix-like systems this method can be failed if Qt was installed into system directories. Super user privileges may be required for 'install' target, so need to do.