Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Issue with QtCharts in Qt6.1.1
Forum Updated to NodeBB v4.3 + New Features

Issue with QtCharts in Qt6.1.1

Scheduled Pinned Locked Moved Solved Qt 6
19 Posts 3 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    ringlery
    wrote on last edited by
    #1

    Greetings,
    I was successfully using QtCharts with an application with Qt 5.15.2. I recently installed Qt 6.1.1 using the online installer on my Macbook Pro running MacOS 11.4. In both cases I use CMake as the build system. Now when I try to compile the application with Qt 6.1.1 I get an error from the generated ui header files that "'QtCharts/chartsnamespace.h' file not found". Looking at the various ui_.h files there is a line "#include <QtCharts/chartsnamespace.h>". I can find the chartsnamespace.h file in the 5.15.2 src directory, but nowhere in the 6.1.1 folder structure. Thinking that the ui_.h files needed to be regnerated, I manually deleted them and made sure that they were recreated during the build process, but the issue remains. Thanks in advance for any insight or advice you might have.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The charts module is not part of Qt 6.1.

      In between you can build it yourself manually.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • R Offline
        R Offline
        ringlery
        wrote on last edited by
        #3

        Greetings,
        Yes, I downloaded the additional package using the maintenance tool, and performed the build and install. I can see the framework in the expected location, as well, so I think everything is ok there. I also tried the same procedure with the 6.2.0 preview and got the same result.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How did you build/install the module ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • R Offline
            R Offline
            ringlery
            wrote on last edited by
            #5

            Hi,
            I follow the instructions in the README located in ~/Qt/6.1.1/Src/qtcharts:

            ~/Qt/6.1.1/clang_64/bin/qmake CONFIG+="debug_and_release build_all"
            make
            make install

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Do you have any cmake file in these sources ?
              I suspect it's Qt 5 sources rather than the dev which is for Qt 6.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • R Offline
                R Offline
                ringlery
                wrote on last edited by
                #7

                There is at least a CMakeLists.txt file in the Qt/6.1.1/Src/qtcharts directory.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What result do you get if you use cmake to build the module rather than qmake ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    ringlery
                    wrote on last edited by
                    #9

                    Hi,
                    Building with CMake gives the following error...

                    cmake .
                    -- The CXX compiler identification is AppleClang 12.0.5.12050022
                    -- The C compiler identification is AppleClang 12.0.5.12050022
                    -- Detecting CXX compiler ABI info
                    -- Detecting CXX compiler ABI info - done
                    -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
                    -- Detecting CXX compile features
                    -- Detecting CXX compile features - done
                    -- Detecting C compiler ABI info
                    -- Detecting C compiler ABI info - done
                    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
                    -- Detecting C compile features
                    -- Detecting C compile features - done
                    CMake Error at CMakeLists.txt:16 (find_package):
                    Could not find a package configuration file provided by "Qt6" (requested
                    version 6.1.1) with any of the following names:

                    Qt6Config.cmake
                    qt6-config.cmake
                    

                    Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
                    to a directory containing one of the above files. If "Qt6" provides a
                    separate development package or SDK, be sure it has been installed.

                    -- Configuring incomplete, errors occurred!
                    See also "/Users/ryan/Qt/6.1.1/Src/qtcharts/CMakeFiles/CMakeOutput.log".
                    See also "/Users/ryan/Qt/6.1.1/Src/qtcharts/CMakeFiles/CMakeError.log".

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Don't build directly in the root of your sources. You should at least create a build folder and run cmake from there.

                      As for the error, pass the CMAKE_PREFIX_PATH pointing to where your Qt 6 cmake files are located.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        ringlery
                        wrote on last edited by
                        #11

                        Hello again,
                        I'm not terribly experienced in using CMake, so this is what I did, but unfortunately there are more errors:

                        mkdir build
                        ❯ build
                        ❯ cmake -D CMAKE_PREFIX_PATH="~/Qt/6.1.1/clang_64/lib/cmake/Qt6" ..
                        -- Looking for pthread.h
                        -- Looking for pthread.h - found
                        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
                        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
                        -- Found Threads: TRUE
                        -- Performing Test HAVE_STDATOMIC
                        -- Performing Test HAVE_STDATOMIC - Success
                        -- Found WrapAtomic: TRUE
                        -- Could NOT find Qt6CoreTools (missing: Qt6CoreTools_DIR)
                        CMake Warning at /Users/ryan/Qt/6.1.1/clang_64/lib/cmake/Qt6/Qt6Config.cmake:97 (find_package):
                        Found package configuration file:

                        /Users/ryan/Qt/6.1.1/clang_64/lib/cmake/Qt6Core/Qt6CoreConfig.cmake
                        

                        but it set Qt6Core_FOUND to FALSE so package "Qt6Core" is considered to be
                        NOT FOUND.
                        Call Stack (most recent call first):
                        CMakeLists.txt:16 (find_package)

                        CMake Error at CMakeLists.txt:16 (find_package):
                        Found package configuration file:

                        /Users/ryan/Qt/6.1.1/clang_64/lib/cmake/Qt6/Qt6Config.cmake
                        

                        but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
                        FOUND. Reason given by package:

                        Failed to find Qt component "Core" config file at ""

                        -- Configuring incomplete, errors occurred!
                        See also "/Users/ryan/Qt/6.1.1/Src/qtcharts/CMakeFiles/CMakeOutput.log".
                        See also "/Users/ryan/Qt/6.1.1/Src/qtcharts/CMakeFiles/CMakeError.log".

                        1 Reply Last reply
                        0
                        • JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by JoeCFD
                          #12

                          use cmake-gui and you can easily find and solve problems

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            ringlery
                            wrote on last edited by
                            #13

                            I used cmake-gui, as suggested and manually set the Qt6*_DIR variables to the appropriate values (otherwise errors are produced as the directories aren't identified). The build process completes and installs properly, but I get the same errors when trying to compile my application.

                            I tried compiling an example that uses QtCharts (datetimeaxis), and that works. I do have some forms that use a QChartView widget. Since the errors are popping up in the generated ui_*.h files, do you think that this is somehow related?

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              How did you put the charts through designer ?
                              Using promotion ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                ringlery
                                wrote on last edited by
                                #15

                                I believe so...it's been a while since I touched the forms, but that rings a bell. Maybe I need to delete it and try the same process in case there's some legacy code still lurking in the background.

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  ringlery
                                  wrote on last edited by
                                  #16

                                  When I use the "promote" option in Designer I can now see where the reference to chartsnamespace.h is coming from (see attachment).

                                  Screen Shot 2021-06-15 at 5.32.36 PM.png

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    ringlery
                                    wrote on last edited by
                                    #17

                                    Ok, solved! I had to reset the the promotion values as described here. I'm attaching a screenshot for reference in case anyone else runs into the same problem.Screen Shot 2021-06-16 at 8.24.18 AM.png

                                    1 Reply Last reply
                                    1
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      Great !

                                      Thanks for the feedback.

                                      Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :-)

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      R 1 Reply Last reply
                                      0
                                      • SGaistS SGaist

                                        Great !

                                        Thanks for the feedback.

                                        Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :-)

                                        R Offline
                                        R Offline
                                        ringlery
                                        wrote on last edited by
                                        #19

                                        @SGaist Done. Thanks for you help!

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved