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 459 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 2 Mar 2020, 20:40 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 2 Mar 2020, 20:48 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
      • M Offline
        M Offline
        mrjj
        Lifetime Qt Champion
        wrote on 2 Mar 2020, 22:10 last edited by mrjj 3 Feb 2020, 22:10
        #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 3 Mar 2020, 05:10 last edited by Fulgurance 3 Mar 2020, 05:10
          #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 1 Reply Last reply 3 Mar 2020, 06:14
          0
          • F Fulgurance
            3 Mar 2020, 05:10

            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 Offline
            J Offline
            J.Hilk
            Moderators
            wrote on 3 Mar 2020, 06:14 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 3 Mar 2020, 06:30 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 1 Reply Last reply 3 Mar 2020, 06:47
              0
              • M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 3 Mar 2020, 06:43 last edited by mrjj 3 Mar 2020, 06:48
                #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
                  3 Mar 2020, 06:30

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

                  Look:
                  Post.png

                  J Offline
                  J Offline
                  J.Hilk
                  Moderators
                  wrote on 3 Mar 2020, 06:47 last edited by J.Hilk 3 Mar 2020, 06:57
                  #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

                  4/8

                  3 Mar 2020, 05:10

                  • Login

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