Questions tagged [qmap]

QMap is a Qt container class that implements a map a.k.a. a skip-list-based dictionary.

This container looks like this:

QMap< Key, T >

It stores key-value pairs, and provides access to the value by the key and vice-versa. It also provides iterator-based access. A typical usage of the QMap is as follows:

//constructs a map with strings as keys and integers as values.
QMap< QString, int > myMap;
//this will set the value for the key "qwerty" if it doesn't exist, or override the current value if it does exist:
myMap["qwerty"] = 15;
//accessing elements is as easy as this:
int i = myMap["qwerty"];

The official QMap documentation can be found here for Qt 4.8 and here for Qt 5.

189 questions
1
vote
2 answers

QMap insert QVector by pointer or value?

I want to build up a map of devices such that the map contains: QString 'DeviceID' and QVector 'Command List' Currently I have the QMap as follows: QMap *> devices; QVector *pCommands= new QVector; // …
code_fodder
  • 15,263
  • 17
  • 90
  • 167
1
vote
3 answers

Retrieve differents Qmap in a single variable

I am working on a game in Qt. My characters/objects are stored in my model Class (I try to follow the MVC model). I created a QMap containing for each of the object : QMap *safes; QMap *mushroom; QMap
ltheron
  • 301
  • 1
  • 3
  • 12
1
vote
1 answer

Problem with QMap return as reference?

Greetings all, I have a code snippet as follows : class AppCtx { private: QMap pluginsMap; public : void addPlugin(IRzPlugin *plugin) { pluginsMap.insert(plugin->getPluginUID(),plugin); } QMap &…
Ashika Umanga Umagiliya
  • 8,988
  • 28
  • 102
  • 185
1
vote
1 answer

R-Map with color points depending on the category

I need to create a map with point given by coordinates but with different colors depending on a variable (let's say 'cat'). data1=data.frame(X=c(-122,-122,-122), Y=c(37,37,38), cat=c('A', 'A', 'B')) map <- qmap('San Francisco', zoom = 12,…
GabyLP
  • 3,649
  • 7
  • 45
  • 66
1
vote
1 answer

QMap iteration crash

I am using Qt 5.5 on Windows 8.1. When I run the code below, the application is able to get through one iteration, but crashes on the second one. 100% reproducible. (Copy/paste it into a Qt Creator instance and test; it might work for you). #include…
nullstellensatz
  • 756
  • 8
  • 18
1
vote
2 answers

How to save a file that contains 2 QMap datas in Qt?

Possible Duplicate: Serialization with Qt I have 2 datas which type is QMap: 1.QMap novel; QString tempChapter; QString tempStory; 2.QMap combo; int tempInd; QString tempChap; my question is: How can I save these 2 Datas into a…
Hanny
  • 85
  • 1
  • 2
  • 5
1
vote
0 answers

Compiling QMap Iterator under OSX (Clang++)

I have a C++ Class CustomMap that implements QMap like so.. template class CustomMap : public QMap Now, in a function: template static TK _at(MK *map, int idx){ ... QMap
1
vote
2 answers

QMap::contains() and QMap::value() does not find existing key-value pair

I am using Qt 4.7.4 with MS Visual C++ 2010. I am using the following QMap: QMap m_oMapHistHandle; where T_FileMapKey is defined as: typedef struct tagT_FileMapKey { int iSubscriptIdx; int iFilterIdx_1; int…
tebe
  • 316
  • 1
  • 8
1
vote
1 answer

How to use java-style iterators instead stl-style in the Qt?

For example : QList > list QList >::iterator i; for (i = list.begin(); i != list.end(); ++i) { QMap::iterator j; for (j = i->begin(); j != i->end(); ++j) …
agent007
  • 11
  • 1
1
vote
2 answers

Qt QList does not append local Objects

I have a understanding-problem why following code does not store any QString-Objects into my QList QMap >map; map = QMap >(); map.insert("eins", QList()); QList listInMap =…
1
vote
1 answer

R: Set X and Y limits when using qmap (ggplot2)

I'm trying to create a map using the qmap (part of ggmap). Here's an example piece of code to illustrate by question. It's kind of silly, but it's cleaner than using my own data. install.packages("ggmap") library(ggmap) qmap("Capitol Building,…
1
vote
1 answer

Deserialized map's size increase in qt c++

I have serialized a map using QDataStream and written the object into a file. The serialized file size is 1.5mb when i deserialize it again and load the map into memory, the memory consumption was 300mb. I have used the same QDataStream to…
aditya
  • 21
  • 2
1
vote
1 answer

Qt core on QMap::freeData()

I have the following stack trace on a core: #1 0x..... in raise() #2 0x..... in abort() #3 0x..... in xehInterpretSavedSigaction() #4 0x..... in xehExceptionHandler() #5 #6 0x..... in QMap::freeData(QMapData*)…
Qman
  • 131
  • 1
  • 1
  • 8
1
vote
1 answer

mapping chemical concentrations with ggplot

I am trying to make map to show the concentrations of Chromium recorded in topsoil in Scotland (n = 1000). The following is a sub-set of the data: Easting Northing Concentration 1 -4.327230 55.94000 1.913814 2 -4.336588 55.77886 …
user3310449
  • 33
  • 1
  • 5
1
vote
3 answers

How to put one QMap into another QMap

Project should give as random number but that is not important, then that number of random find in first map and add into second map. int rand = 2; QPixmap pixmap1 = QPixmap (":/imag/sedam_one.jpg"); QPixmap pixmap2 = QPixmap…
mario
  • 111
  • 2
  • 3
  • 8