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. QMap key (QString) with Space
Forum Updated to NodeBB v4.3 + New Features

QMap key (QString) with Space

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.1k 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.
  • I Offline
    I Offline
    inforathinam
    wrote on last edited by inforathinam
    #1

    I have created a QMap as follows:
    QMap<QString,QString> mymap;

    When i insert "[TP_1::a_33 aa ff]" as key, it is taking only "TP_1::a_33" as key.
    Can someone tell me space is not allowed in the key?

    raven-worxR 1 Reply Last reply
    0
    • I inforathinam

      I have created a QMap as follows:
      QMap<QString,QString> mymap;

      When i insert "[TP_1::a_33 aa ff]" as key, it is taking only "TP_1::a_33" as key.
      Can someone tell me space is not allowed in the key?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @inforathinam
      Please show some code, especially how you create and insert the key.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      I 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @inforathinam
        Please show some code, especially how you create and insert the key.

        I Offline
        I Offline
        inforathinam
        wrote on last edited by
        #3

        @raven-worx
        QString testname = "[TP_1::a_33 aa ff]";
        mymap.insert(testname,"E2_0600_X.sum");

        raven-worxR jsulmJ 2 Replies Last reply
        0
        • I inforathinam

          @raven-worx
          QString testname = "[TP_1::a_33 aa ff]";
          mymap.insert(testname,"E2_0600_X.sum");

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @inforathinam
          this code works, at least in Qt 5.6.

          Maybe your source file itself has some strange encoding?
          Did you compile Qt yourself?
          How does the string look like before inserting it into the hash?

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • I inforathinam

            @raven-worx
            QString testname = "[TP_1::a_33 aa ff]";
            mymap.insert(testname,"E2_0600_X.sum");

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @inforathinam How do you know that only the part before blank is inserted?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0

            • Login

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