Delete item from QMap<int, QString> with shift
For example I want that after map.remove element with index 2 replace your index to 1..
- #include <QApplication>
- #include <QMap>
- #include <QDebug>
- int main(int argc, char **argv)
- {
- QApplication app(argc, argv);
- QMap<int, QString> map;
- map.insert(1, "some1");
- map.insert(2, "some2");
- map.insert(3, "some3");
- map.remove(1);
- qDebug() << map.value(1);
- return app.exec();
- };
Re: Delete item from QMap<int, QString> with shift
Quote:
Originally Posted by
Usernаme
For example I want that after map.remove element with index 2 replace your index to 1..
You you please explain this a little bit better?
Do you want to remove the item at index 2? The item at index 2 is the item with key = "3" and value = "some3".
And do you want the item at index 2 to be replaced by the item at index 1?