Problem with QString. I guess something wrong with declaration as pointer



  • @QString
    Do you have any ideas about this one? I've tried to fix it but nothing really helps;c
    Error happens any time i'm using this selected construction. I guess something might be wrong with declaration and pointers... I'm kind of beginner so can't really find any information on this theme and struggling through this by myself. Снимок экрана 2022-01-09 в 20.44.00.png Снимок экрана 2022-01-09 в 20.44.27.png Снимок экрана 2022-01-09 в 20.44.37.png Снимок экрана 2022-01-09 в 20.44.58.png Снимок экрана 2022-01-09 в 20.45.12.png Снимок экрана 2022-01-09 в 20.45.50.png


  • Lifetime Qt Champion

    Please don't post images but source code which can be copied

    wrt your problem - Pair *m_pair[10] is a pointer to an array and when you have to initialize it before you use it. But I don't see any reason that this

    • must be a pointer at all
    • a c array should be used here instead e.g. std::array<>
    • why the array is bound to exact 10 elements and you don't do any bounds checking at all. Use e.g std::vector<>
    • what the class dictionary should do at all - either use a std::map<QString, QString> (or QMap or QHash) or directly the Qt translation system to translate your strings.

Log in to reply