Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to resolve error messages related to QtChart, QtMultimedia, and QAudioDeviceInfo?
Forum Updated to NodeBB v4.3 + New Features

How to resolve error messages related to QtChart, QtMultimedia, and QAudioDeviceInfo?

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 605 Views
  • 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.
  • B Offline
    B Offline
    beginner123
    wrote on last edited by beginner123
    #1

    I have an old project named MotherVoice, which was written in Qt 5.14.0 several years ago. In preparation for upgrading to Qt 6, I downloaded Qt 5.15.2 and Qt Creator 14.0.1 and updated my scripts accordingly. The updated project is now working properly in Qt 5.15.2. I also checked and confirmed that I had not used any deprecated functions in my scripts.

    Following the "porting-to-Qt6" instructions posted on the Qt webpage (https://doc.qt.io/qt-6/portingguide.html), I proceeded to install Qt 6.8.0 on my computer. However, when I built this project, I encountered 121 error messages. That is a lot of error messages. The good news is that many of these error messages are very similar to each other. It seems that most of the error messages are related to the QtChart and QtMultimedia modules, as well as the QAudioDeviceInfo.

    For example, here is an error message related to QtChart.

    QtChart.png

    Here is an error message related to QtChart::QLineSeries

    QLineSeries.png

    It appears that the QtChart module no longer exists in Qt 6, which is causing a series of error messages.

    For clarity, here are some portions of my scripts where pointers of several QtChart objects were initialized.

    #include <QtCharts>
    #include <QtCharts/QLineSeries>
    #include <QtCharts/QValueAxis>
    #include <QtCharts/QChart>
    #include <QtCharts/QChartView>
    
    // initialize pointers for QtChart objects
    QtCharts::QLineSeries *lineSeries1 = nullptr;   
    QtCharts::QLineSeries *lineSeries3 = nullptr;   
    QtCharts::QLineSeries *lineSeries5 = nullptr;   
    QtCharts::QValueAxis *axisX1 = nullptr;          
    QtCharts::QValueAxis *axisY1 = nullptr;          
    QtCharts::QValueAxis *axisX3 = nullptr;          
    QtCharts::QValueAxis *axisY3 = nullptr;        
    QtCharts::QValueAxis *axisX5 = nullptr;         
    QtCharts::QValueAxis *axisY5 = nullptr;        
    QtCharts::QChart *chart1 = nullptr;             
    QtCharts::QChart *chart3 = nullptr;              
    QtCharts::QChart *chart5 = nullptr;             
    QtCharts::QChartView *chartView1 = nullptr;     
    QtCharts::QChartView *chartView3 = nullptr;      
    QtCharts::QChartView *chartView5 = nullptr;     
    
    Here is an error message related to QtMultimedia::QAudioFormat.

    QAudioFormat.png

    It appears that the QtMultimedia module no longer exists in Qt 6, which is causing another series of error messages.

    For clarity, here are some portions of my scripts where 'QtMultimedia' objects were initialized:

    #include <QtMultimedia/qaudioformat.h>
    #include <QtMultimedia/qaudiooutput.h>
    
    // initialize pointers for QAudioFormat and QAudioOutput objects
    QAudioFormat audioFormat;
    QAudioOutput *audio = nullptr;  
    
    // create and setup a QAudioFormat object
    audioFormat.setSampleRate(static_cast<int>(DATA.fs));
    audioFormat.setChannelCount(1);
    audioFormat.setSampleSize(32);   
    audioFormat.setCodec("audio/pcm");
    audioFormat.setByteOrder(QAudioFormat::Endian(QSysInfo::ByteOrder));  
    audioFormat.setSampleType(QAudioFormat::Float);   
    
    // create an audio output with QAudioFormat
    audio = new QAudioOutput(audioFormat, this);
    
    Here is an error message related to QAudioDeviceInfo.

    QAudioDeviceInfo.png

    For clarity, here is a portion of my scripts that is related to this error message:

    // create a QAudioDeviceInfo object, to make sure that our audioFormat is supported by the device
    QAudioDeviceInfo deviceInfo(QAudioDeviceInfo::defaultOutputDevice());
    if(!deviceInfo.isFormatSupported(audioFormat))
    {
        qWarning() << "Raw audio format not supported by backend, cannot play audio.";
        return;
    }
    

    I tried to follow the instructions posted on the Qt's "porting-to-Qt6" webpage; however, I was unable to resolve these error messages. I also watched several YouTube videos, but I was still unable to resolve them.

    I am just a self-taught hobbyist in Qt programming, so I apologize for any gaps in my knowledge on these matters.

    Any comments or suggestions would be greatly appreciated!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      beginner123
      wrote on last edited by beginner123
      #8

      After considerable effort, I finally updated the QtMultimedia portions of my scripts to Qt 6, with no error messages during the build process. It also worked properly at runtime. Hooray! That is quite an accomplishment.

      Thank you all for your help!

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Bonnie
        wrote on last edited by Bonnie
        #2

        No, the modules are still available, but you need to check the boxes while installing Qt6.
        773829ec-8119-4952-8138-953ddeafb731.png
        You can add the modules by running the maintenance tool again.
        But the QtMultimedia classes do have changed a lot. For QAudioDeviceInfo there're new classes named QMediaDevices and QAudioDevice which have similar functions
        I'm not sure if there's any guide to port these classes, I just read the examples provided by Qt6 and also look for possible function names in the assistant.
        I guess you should check the Audio Devices Example.
        (I do not use QtCharts so don't know it has changed or not)

        B 1 Reply Last reply
        3
        • B Bonnie

          No, the modules are still available, but you need to check the boxes while installing Qt6.
          773829ec-8119-4952-8138-953ddeafb731.png
          You can add the modules by running the maintenance tool again.
          But the QtMultimedia classes do have changed a lot. For QAudioDeviceInfo there're new classes named QMediaDevices and QAudioDevice which have similar functions
          I'm not sure if there's any guide to port these classes, I just read the examples provided by Qt6 and also look for possible function names in the assistant.
          I guess you should check the Audio Devices Example.
          (I do not use QtCharts so don't know it has changed or not)

          B Offline
          B Offline
          beginner123
          wrote on last edited by beginner123
          #3

          @Bonnie

          Thanks a lot for your prompt and insightful responses. Greatly appreciated!

          I did include Qt Charts and Qt Multimedia when installing Qt6. Thank you for pointing this out. Thank you also for describing the other changes. They are useful information. In the meantime, I will try those new changes and continue searching for possible solutions to resolve these error messages.

          B 1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #4

            Wrt to QtCharts you should take a look here: https://doc.qt.io/qt-6/qtcharts-changes-qt6.html
            There is also such a page for every other module.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            B 1 Reply Last reply
            1
            • Christian EhrlicherC Christian Ehrlicher

              Wrt to QtCharts you should take a look here: https://doc.qt.io/qt-6/qtcharts-changes-qt6.html
              There is also such a page for every other module.

              B Offline
              B Offline
              beginner123
              wrote on last edited by
              #5

              @Christian-Ehrlicher
              Yes! I followed the instructions over the Qt webpage and resolved all error messages related to QtCharts. Thank you SO MUCH!

              I will be working on the other error messages.

              1 Reply Last reply
              0
              • B beginner123

                @Bonnie

                Thanks a lot for your prompt and insightful responses. Greatly appreciated!

                I did include Qt Charts and Qt Multimedia when installing Qt6. Thank you for pointing this out. Thank you also for describing the other changes. They are useful information. In the meantime, I will try those new changes and continue searching for possible solutions to resolve these error messages.

                B Offline
                B Offline
                beginner123
                wrote on last edited by beginner123
                #6

                @beginner123

                Yes! Following your comments, I replaced QAudioDeviceInfo with QMediaDevices and QAudioDevice with success. Thank you SO MUCH!

                I will be working on the QtMultimedia classes the next.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  beginner123
                  wrote on last edited by beginner123
                  #7
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    beginner123
                    wrote on last edited by beginner123
                    #8

                    After considerable effort, I finally updated the QtMultimedia portions of my scripts to Qt 6, with no error messages during the build process. It also worked properly at runtime. Hooray! That is quite an accomplishment.

                    Thank you all for your help!

                    1 Reply Last reply
                    1
                    • B beginner123 has marked this topic as solved on

                    • Login

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