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. Could you please help me with some modifications to my Qt6 code?
Forum Updated to NodeBB v4.3 + New Features

Could you please help me with some modifications to my Qt6 code?

Scheduled Pinned Locked Moved Unsolved Qt 6
8 Posts 4 Posters 1.1k 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.
  • Teemo of LOLT Offline
    Teemo of LOLT Offline
    Teemo of LOL
    wrote on last edited by
    #1

    How can I fix the error 'C2039: 'data' is not a member of 'QWeakPointer<QCPAbstractPaintBuffer>'. that occurs when running it? plz help me

    void QCPLayer::setMode(QCPLayer::LayerMode mode)
    {
    if (mMode != mode)
    {
    mMode = mode;
    if (!mPaintBuffer.isNull())
    mPaintBuffer.data()->setInvalidated();
    }
    }

    thx

    jsulmJ 1 Reply Last reply
    0
    • Teemo of LOLT Teemo of LOL

      How can I fix the error 'C2039: 'data' is not a member of 'QWeakPointer<QCPAbstractPaintBuffer>'. that occurs when running it? plz help me

      void QCPLayer::setMode(QCPLayer::LayerMode mode)
      {
      if (mMode != mode)
      {
      mMode = mode;
      if (!mPaintBuffer.isNull())
      mPaintBuffer.data()->setInvalidated();
      }
      }

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Teemo-of-LOL Why is mPaintBuffer a QWeakPointer?

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

      Teemo of LOLT 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Teemo-of-LOL Why is mPaintBuffer a QWeakPointer?

        Teemo of LOLT Offline
        Teemo of LOLT Offline
        Teemo of LOL
        wrote on last edited by
        #3

        @jsulm Why is mPaintBuffer a QWeakPointer? I'm not sure about this part. This code was written previously, and it worked fine in Qt5. I tried searching on Google and made some modifications as follows. Is there anything suspicious in this?

        void QCPLayer::setMode(QCPLayer::LayerMode mode)
        {
        if (mMode != mode)
        {
        mMode = mode;
        if (!mPaintBuffer.isNull())
        {
        auto paintBuffer = mPaintBuffer.toStrongRef();
        if (paintBuffer)
        paintBuffer->setInvalidated();
        }

        }
        }

        thx

        jsulmJ 1 Reply Last reply
        0
        • Teemo of LOLT Teemo of LOL

          @jsulm Why is mPaintBuffer a QWeakPointer? I'm not sure about this part. This code was written previously, and it worked fine in Qt5. I tried searching on Google and made some modifications as follows. Is there anything suspicious in this?

          void QCPLayer::setMode(QCPLayer::LayerMode mode)
          {
          if (mMode != mode)
          {
          mMode = mode;
          if (!mPaintBuffer.isNull())
          {
          auto paintBuffer = mPaintBuffer.toStrongRef();
          if (paintBuffer)
          paintBuffer->setInvalidated();
          }

          }
          }

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Teemo-of-LOL Should work, just try

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

          Christian EhrlicherC Teemo of LOLT 2 Replies Last reply
          0
          • jsulmJ jsulm

            @Teemo-of-LOL Should work, just try

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by Christian Ehrlicher
            #5

            @jsulm Now I only wonder where the strong ref on the weak pointer is - otherwise it's always a nullptr.

            @Teemo-of-LOL: Please format you code with the code (</>) - tags so it's readable!

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

            Teemo of LOLT 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @jsulm Now I only wonder where the strong ref on the weak pointer is - otherwise it's always a nullptr.

              @Teemo-of-LOL: Please format you code with the code (</>) - tags so it's readable!

              Teemo of LOLT Offline
              Teemo of LOLT Offline
              Teemo of LOL
              wrote on last edited by
              #6

              @Christian-Ehrlicher I will use tags for reference.

              thx

              1 Reply Last reply
              0
              • jsulmJ jsulm

                @Teemo-of-LOL Should work, just try

                Teemo of LOLT Offline
                Teemo of LOLT Offline
                Teemo of LOL
                wrote on last edited by
                #7

                @jsulm thank you. i will try

                thx

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  ttyy
                  wrote on last edited by
                  #8

                  Have you solved this problem yet? I'm having the same problem trying QT6!

                  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