To build modern and responsive graphical user interfaces (GUIs) for CVB applications, the Qt framework provides a flexible and powerful foundation. Whether you're working with classic Qt Widgets or a QML-based interface, CVB offers native support for both through its Cvb::UI
module. This section explains how to integrate CVB image display functionality into your Qt or QML application using C++.
Before starting, ensure that you have installed Common Vision Blox (CVB) and CMake, and that you've successfully built a basic CVB application, as described in Getting Started with C++.
To integrate Qt/QML into your CVB C++ project, you will also need to download and install Qt5.
If you already have a working CMakeLists.txt for your CVB application, you only need to add a few lines to enable Qt/QML support.
To locate the necessary Qt components, use find_package
:
Then, link the required Qt modules and CVB libraries. To enable the integration between CVB and Qt, also link against CVB::CvbUI
.
CMAKE_PREFIX_PATH
is correctly set (e.g., to C:/Qt/Qt5.14.2/5.14.2/msvc2017_64/lib/cmake
) so that CMake can locate your Qt installation. Additionally, add the Qt bin
directory to your system PATH environment variable to ensure the Qt runtime DLLs can be found when running your application.For more in-depth instructions and troubleshooting, refer to the post Getting Started with CVB++, QML, CMake in the CVB User Forum.
To simplify the integration of Qt with CVB, the library provides the Cvb::UI
module. It allows you to easily display CVB images within Qt applications using the Cvb::UI::ImageView
widget.
If you are working with a QML-based user interface, refer to the Cvb::UI::Quick
module, which provides QML-compatible components.
For example applications, see the next section.
Your CVB installation includes several example programs demonstrating the integration of CVB with Qt and QML. These examples include complete C++ source code and a working CMakeLists.txt
. They are located under %CVB%Tutorial
(Windows) or $CVB/tutorial
(Linux). Look for examples starting with Qt
or Qml
in their names: