0

How can I make a QList of QList?

This:

QList<QList<QString>> output;

Results:

error: template argument 1 is invalid QList output;

UPDATE

My Qt version:

enter image description here

Jack
  • 16,276
  • 55
  • 159
  • 284
  • what is the problem? – eyllanesc Jul 13 '18 at 02:46
  • I'll edit the error, sorry. – Jack Jul 13 '18 at 02:47
  • @eyllanesc added. – Jack Jul 13 '18 at 02:48
  • I find it strange, in Qt 5.11 I do not see that problem: https://imgur.com/a/2AKkgKZ, Although it would be more readable to use: `QList output;` – eyllanesc Jul 13 '18 at 02:52
  • The line is working just fine in the tags you've added. Please provide a minimal working example to regenerate the problem. More info is needed such as the compiler, the pro. file, and the cpp file. – CroCo Jul 13 '18 at 03:00
  • I'm using Qt 5.5.0... maybe Support for this was added later? – Jack Jul 13 '18 at 03:06
  • Unfortunately I can't use a high version because QWebView doesn't work well on high versions. Any workaround? – Jack Jul 13 '18 at 03:07
  • it's not a issue with 5.5. Try adding a space between angle brackets: `QList >`. And also make sure you have all necessary includes `#include ` and `#include ` – Alexey Andronov Jul 13 '18 at 03:09
  • @AlexeyAndronov it worked adding the spaces oO why? – Jack Jul 13 '18 at 03:11
  • 3
    @Jack Some old compilers think that the `>>` part of `QList>` is the `operator>>`. Adding the space tells the compiler that that's not the case. – Donald Duck Jul 13 '18 at 03:12
  • 2
    you compile with old c++ standart, this issue was fixed in c++11 see [this](https://stackoverflow.com/questions/15785496/c-templates-angle-brackets-pitfall-what-is-the-c11-fix) question – Alexey Andronov Jul 13 '18 at 03:15
  • 4
    In particular this happens before C++11 on compilers that conform to the standard; even then many compilers added support for figuring out when you did this. – Daniel H Jul 13 '18 at 03:15
  • Possible duplicate of [Template within template: why "\`>>' should be \`> >' within a nested template argument list"](https://stackoverflow.com/questions/6695261/template-within-template-why-should-be-within-a-nested-template-arg) – eyllanesc Jul 13 '18 at 03:18
  • 1
    @Jack Also, have you considered using [Qt WebEngine](https://doc.qt.io/qt-5.11/qtwebengine-index.html) instead of QWebView? QWebView is deprecated and Qt WebEngine is supposed to be used instead, see http://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html. Qt WebEngine works well with the latest version of Qt. – Donald Duck Jul 13 '18 at 03:24
  • Even though the problem has been found to be the use of C++11 closing right angled brackets, it's still very peculiar you get this error because you're using MSVC 2013 for the compiler and [even MSVC 2010 had support for this C++11 feature](https://msdn.microsoft.com/en-us/library/hh567368.aspx#Anchor_0). Weird. – acraig5075 Jul 13 '18 at 06:12

0 Answers0