Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with QString. I guess something wrong with declaration as pointer

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 210 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qumetri
    wrote on 9 Jan 2022, 17:48 last edited by
    #1

    @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

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 9 Jan 2022, 18:19 last edited by
      #2

      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.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2

      1/2

      9 Jan 2022, 17:48

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved