Questions tagged [qhash]

QHash is a Qt template class that provides a hash-table-based dictionary

QHash provides very similar functionality to QMap. The differences are:

  • QHash provides faster lookups than QMap.
  • When iterating over a QMap, the items are always sorted by key. With QHash, the items are arbitrarily ordered.
  • The key type of a QMap must provide operator<(). The key type of a QHash must provide operator==() and a global hash function called qHash() (see qHash).

Documentation can be found here for Qt 4.8 and here for Qt 5.

68 questions
0
votes
1 answer

QHash - hot to get a random key and value

I want to get a random pair with number n from my QHash. Now I do it this way: QHash::iterator iterator = dictionary.begin(); iterator+= n; question->setText(iterator.key()); But this seems just ridiculous... There must be a normal…
Kolyunya
  • 5,973
  • 7
  • 46
  • 81
0
votes
1 answer

Qt QString "key-value" replace from QHash

I have a QString with content that looks something like this: "resolution=[imagesize]&quality=[imagequal]". And I have a QHash mDefaults container that holds a list with some of my 'key' values. ("imagesize" and "imagequal" are so…
Gediminas
  • 1,830
  • 3
  • 27
  • 47
0
votes
1 answer

Not able to Seralize QHash to DataStream

while leaning about QHash and serializing QHash to DataStream I got an error with the following code. typedef QHash hashtype1; typedef QHash hashtype; hashtype1 hash; hash.insert(1,…
Jis
  • 127
  • 2
  • 12
0
votes
1 answer

Long length key in QHash

I want to create a QHash with 64 chars key and about 1 milion records. is it possible ? is any limit on size of key? i got conflict in records.
Mohammad Sheykholeslam
  • 1,379
  • 5
  • 18
  • 35
0
votes
3 answers

Is the QHash::contains method case-sensitive or case-incensitive?

I have a QHash. I use the following expression to check whether a value is there in the QHash::keys() or not. //programme QHash samplehash; QString value = "somevalue"; if(samplehash.contains(value)) // Condition -…
Ajay
  • 9,947
  • 8
  • 32
  • 34
0
votes
1 answer

Segmentation fault in QHash

I got the following crash in QHash. I am unable to find any thing into. I am using Qtopia-Core-4.3.3 on Linux Machine. The log is as follows: ASSERT: "*node == e || (*node)->next" in file …
Ajay
  • 9,947
  • 8
  • 32
  • 34
-1
votes
2 answers

Writing custom qhash() function for my class

I would like to use a QHash (as a member of MyOwnClass if it does matter). Docs say that one should define a global qhash(MyOwnClass&) function. OK, for example: globals.h: #pragma once #include "myOwnClass.h" #include…
N. Kudryavtsev
  • 3,556
  • 1
  • 26
  • 30
-2
votes
1 answer

Replace qhash value no operator found which takes a right-hand operand of type

I have QHash * index_hash; value in .h file I have (MyClass*item) that pass as function param I can go through with myFunc (MyClass*item) { QHash ::iterator itt; for (it = index_hash->begin(); it != …
streamc
  • 676
  • 3
  • 11
  • 27
1 2 3 4
5