Questions tagged [qmultimap]

QMultiMap is a class from the Qt Toolkit which is a convenience QMap subclass that provides multi-valued maps. The QMap class is a template class that provides a red-black-tree-based dictionary.

Documentation can be found here (Qt4) and here (Qt5).

11 questions
6
votes
2 answers

QMap::insertMulti or QMultiMap?

What should i use between QMap::insertMulti and QMultiMap to handle : 2 -> abc 2 -> def 3 -> ghi 3 -> jkl What's the difference enter the 2 solutions ?
canardman
  • 3,103
  • 6
  • 26
  • 28
6
votes
2 answers

Order of items in QMap and QMultiMap

I would like to use QMultiMap (which is derived from QMap) to store key/value pairs. Since I can have keys multiple times I would prefer to use QMultiMap. Assume I would insert the following pairs in the given order: "C" -> 5 "A" -> 10 "B" -> 77 "B"…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
2
votes
1 answer

exporting QMultiMap to QML

I have following QObject: #ifndef UETYPES #define UETYPES #include #include #include #include #include #include "../database/ueuserrecord.h" #include "../database/ueorderrecord.h" class UeTypes…
KernelPanic
  • 2,328
  • 7
  • 47
  • 90
1
vote
1 answer

Is it possible to use to use QMultiMap::ConstIterator in own template class?

I want to iterate over a QMultiMap using QMultiMap::const_iterator it;` but the compiler complains error: expected ‘;’ before ‘it’ resulting in a error: ‘it’ was not declared in this scope for every usage. I tried…
mbx
  • 6,292
  • 6
  • 58
  • 91
1
vote
1 answer

QMultiMap And QDataStream

I saw in QtAssistant that QDataStream supports QMap and QMultiMap inherits QMap . Does Qt support QMultiMap for serialization with QDataStream ?
amiref
  • 3,181
  • 7
  • 38
  • 62
1
vote
1 answer

Is this use of QMap potentially harmful?

#include template TKey lastKeyOf(const QMap& map) { if (map.isEmpty()) throw something; return (map.end() - 1).key(); } The reason I ask is that: template
Martin Drozdik
  • 12,742
  • 22
  • 81
  • 146
0
votes
1 answer

Unused container warning when iterating over values of a specific key in QMultiMap

i get an "allocating unneeded temporary container" warning when i try to iterate over the values of a specific key in a QMultiMap: QMultiHash testMap; for (auto &&value : testMap.values("Specific Key")) { …
UrbanCee
  • 1
  • 1
0
votes
2 answers

QMultiMap with QVariant as key

I have a multimap with QVariant as key, but it's not working with QByteArray. The funcion map.values("\xc2\x39\xc7\xe1") is returning all the values of the map. This is a small example: #include #include #include…
Fausto01
  • 171
  • 14
0
votes
1 answer

Why is this local QMultiMap detaching when modified?

To give some background: in my project I put a debug breakpoint inside QMap::detach_helper because I wanted to see if I could spot any occurrences when implicitly shared QMaps were detaching due to an oversight e.g. using find when constFind could…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

QMultiMap with struct as key and struct as value, comparison operators

I have two structs, for example, first struct as key in QMultiMap: struct KeyStruct { int keydata1; int keydata2; int keydata3; bool operator < ( const KeyStruct& o ) const { return keydata1 < o.keydata1 || keydata2 <…
esterlein
  • 91
  • 1
  • 10
-1
votes
1 answer

How to get key from value in QMultiMap?

I have QMultiMap as follows: QMultiMap paramIDMap, paramValueMap; My value is "xyz" and i want to take it's key. Example: paramIDMap.getkey("xyz") like this How to do this? Expected output should return key.
Cm Jagtap
  • 147
  • 1
  • 2
  • 10