Written by marcelpetrick
on February 1, 2019
Qt (or Digia? or how was the company-owning-Qt called at that time?) released in 2014 the version 1.4 of their Charts add-on for Qt. It was available only for the commercial-license and had some distinc namespace-requirements. And was also quite bare-metal.
Further development lead to more opportunities regarding the emitted signals for the cursor-handling (pressed/released instead of just clicked, for instance) and it became part of the regular package for Qt.
## Advice for a CMake-based project ##
If you want to maintain and upgrade your legacy code, then:
- add “Charts” to your find_package:
1find_package(Qt5 COMPONENTS Widgets Charts REQUIRED) - change the namespace inside the CMakeLists from “former naming” to “Qt5::Charts”
- remove the dependency to the old package in the top-level CMakeLists.txt
- replace inside the h/cpp all occurences of “QtCommercialChart::” with “QtCharts::”
- replace inside the h/cpp all occurences of “QTCOMMERCIALCHART_USE_NAMESPACE” with “using namespace QtCharts;”
- update the installer-creator-script(s) to include the Qt5Charts.dll
Et voilà , it should build now.