Updating to the current package of Qt Charts (from the commercial version)

Written by  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:

  1. add “Charts” to your find_package:
  2. change the namespace inside the CMakeLists from “former naming” to “Qt5::Charts”
  3. remove the dependency to the old package in the top-level CMakeLists.txt
  4. replace inside the h/cpp all occurences of “QtCommercialChart::” with “QtCharts::”
  5. replace inside the h/cpp all occurences of “QTCOMMERCIALCHART_USE_NAMESPACE” with “using namespace QtCharts;”
  6. update the installer-creator-script(s) to include the Qt5Charts.dll

Et voilà , it should build now.

Category : C++cmakeQt