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 fix the code when upgrade from QT 6.7 to 6.8 - Furthur on your experience how to pass this situation
Qt 6.11 is out! See what's new in the release blog

How to fix the code when upgrade from QT 6.7 to 6.8 - Furthur on your experience how to pass this situation

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.2k 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.
  • V Offline
    V Offline
    Videas
    wrote on last edited by Videas
    #1

    Hi, I am a newbie, doing an internship and work with a software built by QT (I also work with other programming before but not QT). The old version is 6.7.3, now I am working in upgrading process, from QT 6.7.3 to 6.8.3. I met a lot of isssues due to the different of versions. I was stuck with this Qhri for sometime.
    ()error: non-const lvalue reference to type 'QRhi' cannot bind to a value of unrelated type 'QRhi ()non-const lvalue reference to type 'QRhi' cannot bind to a value of unrelated type 'QRhi *'
    m_videoFrameTextures = QVideoTextureHelper::createTextures(m_currentFrame, rhi, resourceUpdates, std::move(m_videoFrameTextures));

      |                                                                                            ^
    

    66c9220c-138a-4ad5-a817-a885fd296ce6-image.png

    Firstly, do anyone have ideas what issue with this one and how can I fix it.
    Moreover, in my situation, what the process you guys usually do to understand the code and learn how to fix it? Any good resource that I can check? I was pretty stressful because I don't understand all the code programmed by the previous one, especially when he is an experience one, I didn't build it from scratch so some issues pop up but I don't even know where and why it likes that. Those issue usually consumed a lot of time and my internship period is passing quickly. I want to hear your suggestion and experience to improve in the future. Thank you

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

      QVideoTextureHelper is a private Qt class so the first question is why do you use it at all.
      then you need to pass qrhi as constant reference instead a pointer.
      And please post code instead screenshots.

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

      1 Reply Last reply
      2
      • V Offline
        V Offline
        Videas
        wrote on last edited by
        #3

        Here is the original code, these function is used in calibration for frame in video.

        void CalibrationMaterial::updateTextures(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
        {
        if (!m_frameDirty and !m_calibrationDirty)
        return;

        if (m_frameDirty) {
            // keep the video frames alive until we know that they are not needed anymore
            Q_ASSERT(NVideoFrameSlots >= rhi->resourceLimit(QRhi::FramesInFlight));
            m_videoFrameSlots[rhi->currentFrameSlot()] = m_currentFrame;
        
            // update and upload texture(s)
            m_videoFrameTextures = QVideoTextureHelper::createTextures(m_currentFrame, rhi, resourceUpdates, std::move(m_videoFrameTextures));
            if (m_videoFrameTextures) {
                m_frameTexture.setData(QRhiTexture::R16, m_currentFrame.size(), nullptr, 0);
                m_frameTexture.setRhiTexture(m_videoFrameTextures->texture(0));
                m_frameDirty = false;
            } else {
                qWarning("Failed to create video texture");
            }
        }
        
        if (m_calibrationDirty) {
            m_calibrationRhiTexture.reset(rhi->newTexture(QRhiTexture::RGBA32F, m_calibrationImage.size()));
            m_calibrationTexture.setTextureSize(m_calibrationImage.size());
            if (m_calibrationRhiTexture->create()) {
                QRhiTextureSubresourceUploadDescription subresDesc;
                subresDesc.setData(QByteArray::fromRawData(
                    reinterpret_cast<const char *>(m_calibrationImage.constBits()), m_calibrationImage.sizeInBytes()));
                subresDesc.setDataStride(m_calibrationImage.bytesPerLine());
                QRhiTextureUploadEntry entry(0, 0, subresDesc);
                QRhiTextureUploadDescription desc({ entry });
                resourceUpdates->uploadTexture(m_calibrationRhiTexture.get(), desc);
                m_calibrationTexture.setTexture(m_calibrationRhiTexture.get());
                m_calibrationDirty = false;
            } else {
                qWarning("Failed to create calibration texture");
            }
        }
        

        }

        //=======================

        void updateTextures(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates);

        //=======================

        The previous one who built this app did that, used the private header and also changed something in it. I don't understand much about that, that why I said it hard to understand especially he is experience one.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Videas
          wrote on last edited by
          #4

          If I try to change to pass qrhi as constant reference instead a pointer, it would have some issue to the other functions.

          JonBJ jsulmJ 2 Replies Last reply
          0
          • V Videas

            If I try to change to pass qrhi as constant reference instead a pointer, it would have some issue to the other functions.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #5

            @Videas
            This is what happens when people write code to call undocumented/non-public functions.
            As per https://codebrowser.dev/qt6/qtmultimedia/src/multimedia/video/qvideotexturehelper.cpp.html#_ZN19QVideoTextureHelper14createTexturesERK11QVideoFrameR4QRhiR23QRhiResourceUpdateBatchSt10unique_ptrI19QVideoFrameTexturesSt14default_deleteIS8_EE, if you are trying to call

            QVideoFrameTexturesUPtr createTextures(const QVideoFrame &frame, QRhi &rhi,
                                                   QRhiResourceUpdateBatch &rub,
                                                   QVideoFrameTexturesUPtr oldTextures)
            

            did you try passing *rhi in place of where you pass rhi?

            V 1 Reply Last reply
            0
            • V Videas

              If I try to change to pass qrhi as constant reference instead a pointer, it would have some issue to the other functions.

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Videas said in How to fix the code when upgrade from QT 6.7 to 6.8 - Furthur on your experience how to pass this situation:

              it would have some issue to the other functions

              What issue?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • JonBJ JonB

                @Videas
                This is what happens when people write code to call undocumented/non-public functions.
                As per https://codebrowser.dev/qt6/qtmultimedia/src/multimedia/video/qvideotexturehelper.cpp.html#_ZN19QVideoTextureHelper14createTexturesERK11QVideoFrameR4QRhiR23QRhiResourceUpdateBatchSt10unique_ptrI19QVideoFrameTexturesSt14default_deleteIS8_EE, if you are trying to call

                QVideoFrameTexturesUPtr createTextures(const QVideoFrame &frame, QRhi &rhi,
                                                       QRhiResourceUpdateBatch &rub,
                                                       QVideoFrameTexturesUPtr oldTextures)
                

                did you try passing *rhi in place of where you pass rhi?

                V Offline
                V Offline
                Videas
                wrote on last edited by
                #7

                @JonB Oh, right. I just did and it worked. I was tried to change CalibrationMaterial::updateTextures(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) to void CalibrationMaterial::updateTextures(QRhi &rhi, QRhiResourceUpdateBatch *resourceUpdates) so many other issues occured and I tried to fix them. But wit just *rhi, it solved.

                1 Reply Last reply
                0
                • V Videas 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