Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QtCreator 2.1.0 final Nested QMap coloring error



  • On Qt Creator 2.1.0 final, I added a member function which returns a nested QMap defined as:
    QMap< QString, QMap<QString, QString> >

    But QtCreator colors it as an error, if I build my project everything works as it should, but I guess the text coloring parser has some problems coloring this. Here's a screenshot:

    !http://www.jimi.com.mx/u/nestedQMap.png(error)!

    just to be sure, I even removed the parameter name and just left the type (just in case the parser is super strict) but still no luck, keeps marking the error on both .h and .cpp so, what do you guys think, it's a bug? please someone else try it to see if it happens to anyone else as well so maybe we can report this.



  • You're missing a space between the two >> characters...



  • [quote author="peppe" date="1299798621"]You're missing a space between the two >> characters...[/quote]

    Indeed. The ">>" of the templates are interpreted as "operator >>" which is the stream input operator.



  • Ok, but that shouldn't happen right? because I'm declaring a return statement here, or can there be a return statement with stream operators?



  • Shouldn't happen what? Is that code automatically generated by Creator or did you mistype it?



  • [quote author="Raul" date="1299802219"]Ok, but that shouldn't happen right? because I'm declaring a return statement here, or can there be a return statement with stream operators?[/quote]

    That's a valid C++ error. Consider ">>" as a keyword - you can use it only where it is allowed.



  • Or once C++0x finally arrives in Qt land, you can then freely use them without space in nested templates. :)



  • Shouldn't that be "Or once C++0x finally arives. (period)"? AFAIK, it is still only a proposal, not a finalized standard?



  • [quote author="Andre" date="1300011528"]Shouldn't that be "Or once C++0x finally arives. (period)"? AFAIK, it is still only a proposal, not a finalized standard?[/quote]

    True. That's what I know too.

    Time to change the beast's name to "C++1x" :-)



  • Some of the C++0x features have made into to gcc/mingw. I am not sure nested right brackets is allowed but I used auto a lot until I find out Mac is stuck in the last century thanks to Apple.

    I really hope LLVM/clang support in Qt is coming quickly. A common compiler target makes life a lot easier.


Log in to reply