Problem to compile my program with QVector
-
Hello, today i have added MainWindow class with task gesture. It's just the beginning.
But when i compile, i have strange error.Look:
-
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 *.
-
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 * -
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 ? -
Yes, i have already do your advice, but i have removed it because it's the same result.
Look:
-
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.
-
@Fulgurance what @mrjj wrote!
also foreach is deprecated you are supposed to use the std range based for.
For example:for( QWebEngineView *task : *WebViewTasks ){ ... }