Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Not able to extract QString from QHash

Not able to extract QString from QHash

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 2 Posters 645 Views 1 Watching
  • 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    extern QHash<int, QString> StationHash;

    @
    =========Method 1=======
    int var =5
    QHash<int, QString>::iterator i;
    for( i=StationHash.begin(); i != StationHash.end(); i++ )
    {
    QString NextThai = i.key(var);
    }
    ==========Method 2==============
    int var=5;
    QString NextThai= StationHash(5);

    @

    i got an error message for both methods. How to extract Qstring in StationHash
    no matching function for call to QHash <int,QString>:: key(int)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      @QString str = myHash.value(5);@

      You hash use an int as key and a QString as value.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - 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