Problem to compile my program with QVector
-
wrote on 2 Mar 2020, 20:40 last edited by
-
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 *.
-
Lifetime Qt Championwrote on 2 Mar 2020, 22:10 last edited by mrjj 3 Feb 2020, 22:10
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" errorsSo 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 * -
wrote on 3 Mar 2020, 05:10 last edited by 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.@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 likeWebViewTasks = new QVector<QWebENgineView *>
to you ? -
wrote on 3 Mar 2020, 06:30 last edited by
-
Lifetime Qt Championwrote on 3 Mar 2020, 06:43 last edited by mrjj 3 Mar 2020, 06:48
You did not change the foreach
it must match the type of the elementforeach ( QWebEngineView *task, *WebViewTasks )
So if your list is pointers, you take out a pointer or a & pr task.
-
Yes, i have already do your advice, but i have removed it because it's the same result.
Look:
@Fulgurance what @mrjj wrote!
also foreach is deprecated you are supposed to use the std range based for.
For example:for( QWebEngineView *task : *WebViewTasks ){ ... }
4/8