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:
    @
    #define DATA QHash<QString,QString>
    #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.



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



  • 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,



  • You are right! Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.