May 5, 2012

blah900 blah900
Lab Rat
4 posts

Nested qhash visual problems in QT Creator

 

So for my project because I don’t want to type things over and over again, I have the following:

  1. #define DATA QHash<QString,QString>
  2. #define DATASHEET QHash<QString,DATA>

However when I use DATASHEET, I get the following warning red underline with the text “Expected a declaration”. It compiles and works correctly but it’s very annoying because 1. it’s red underline which constantly trigger the thought that I did something wrong, and 2. I can’t use the popup helper that appears when I am accessing its functions. Is there a workaround to this? Manually typing QHash<QString,DATA> works fine. However, using DATASHEET as QHash<QString,QHash<QString,QString>> also causes the red underlines to popup.

If there is no workaround, I will just manually type QHash<QString,DATA> but I was wondering if there was a workaround.

Thanks in advance.

3 replies

May 9, 2012

apoenitz apoenitz
Lab Rat
15 posts

What happens if you use typedefs instead of macros when defining the types?

May 9, 2012

Thanatos.jsse Thanatos.jsse
Lab Rat
63 posts

I did have the same problem using QList<QList<something>>, the problem was the double >> at the end of definition.

Try writing QHash<QStrsing, QHash<QString, QString> >, and be carrefull whit the space at the end.

BR,

May 9, 2012

blah900 blah900
Lab Rat
4 posts

You are right! Thanks!

 
  ‹‹ Problems using macdeployqt : malformed object (unknown load command 8)      Program Startup takes a long time. ››

You must log in to post a reply. Not a member yet? Register here!