I am working on a project that has a 2d map:
QMap < int, QMap < int, QPixmap> > slot_pic;
I set up a table to initialize the values:
slot_pic[0][0] = QPixmap("path...");
slot_pic[1][0] = QPixmap("path...");
slot_pic[2][0] = QPixmap("path...");
slot_pic[3][0] = QPixmap("path...");
...
Occasionally, the second key would get changed like this:
...
slot_pic[300][0] = QPixmap("path...");
slot_pic[300][1] = QPixmap("path...");
slot_pic[300][2] = QPixmap("path...");
slot_pic[300][3] = QPixmap("path...");
slot_pic[301][0] = QPixmap("path...");
...
At a certain point in my program, I come across a key that I only want to look at the first number. The path of the pixmap is then only dependent on the first key. Like this:
...
slot_pic[357][0] = QPixmap("path...");
slot_pic[358] = QPixmap("path...");
slot_pic[359][0] = QPixmap("path...");
...
But obviously, I get a syntax error. How can I tell my program to only look at the first key if that key is a number I define? (358) I COULD write it a thousand times each time like this:
...
slot_pic[358][1] = QPixmap("path...");
slot_pic[358][2] = QPixmap("path...");
...
slot_pic[358][50] = QPixmap("path...");
slot_pic[358][55] = QPixmap("path...");
...
So basically, how can I make a 2d map only dependent on one key?
NOTE: I do not want to change the value of the second key, it is needed later in my program. I only want to stop looking at it at a certain key in my map.
I tried to explain this as best as I could. Any help would be appreciated :)