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. Problem to compile my program with QVector
Forum Updated to NodeBB v4.3 + New Features

Problem to compile my program with QVector

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 425 Views 2 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.
  • F Offline
    F Offline
    Fulgurance
    wrote on last edited by
    #1

    Hello, today i have added MainWindow class with task gesture. It's just the beginning.
    But when i compile, i have strange error.

    Look:

    Post.png

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

      Hi,

      From the looks of it you are passing a pointer to a pointer to a QVector in your foreach.

      Make that vector a normal stack based class member variable. If you do not what to do that, replace that & by a *.

      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
      5
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        Hi
        also for the QWebEngiveView (task) you need & or Pointer *
        as
        foreach ( QWebEngiveView task, *WebViewTasks )
        alone will try to copy it and hence the
        "use of deleted function" errors

        So something like
        foreach ( QWebEngiveView *task, *WebViewTasks )

        You seem to declare your vector as
        QVector<QWebEngineView>
        Which is not allowed as any QWidget cannot be copied.
        so it has to be
        QVector<QWebEngineView *> <<< note the *

        1 Reply Last reply
        2
        • F Offline
          F Offline
          Fulgurance
          wrote on last edited by Fulgurance
          #4

          No, i have tested with pointer for QVector, but the same problem.

          And i have apply your advices, but same problem to compile.
          If i pass * to the parameters,i have syntax error.

          Post.png

          J.HilkJ 1 Reply Last reply
          0
          • F Fulgurance

            No, i have tested with pointer for QVector, but the same problem.

            And i have apply your advices, but same problem to compile.
            If i pass * to the parameters,i have syntax error.

            Post.png

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @Fulgurance said in Problem to compile my program with QVector:

            No, i have tested with pointer for QVector, but the same problem.
            And i have apply your advices,

            you did not.

            take a look at line 19
            does that look like WebViewTasks = new QVector<QWebENgineView *> to you ?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            1
            • F Offline
              F Offline
              Fulgurance
              wrote on last edited by
              #6

              Yes, i have already do your advice, but i have removed it because it's the same result.

              Look:
              Post.png

              J.HilkJ 1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                You did not change the foreach
                it must match the type of the element

                foreach ( QWebEngineView *task, *WebViewTasks )
                

                So if your list is pointers, you take out a pointer or a & pr task.

                1 Reply Last reply
                3
                • F Fulgurance

                  Yes, i have already do your advice, but i have removed it because it's the same result.

                  Look:
                  Post.png

                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by J.Hilk
                  #8

                  @Fulgurance what @mrjj wrote!

                  also foreach is deprecated you are supposed to use the std range based for.
                  For example:

                  for( QWebEngineView *task : *WebViewTasks ){
                       ...
                  }
                  

                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  2

                  • Login

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