Hi,
How do we remove all value of particular key in QMultiHash.
thanks,
Hi,
How do we remove all value of particular key in QMultiHash.
thanks,
The doc says QMultiHash::remove(const Key &key) will remove all of the items that match the key. QMultiHash::remove(const Key &key, const T &value) will remove a specific key/value pair.
Have you tried that method?
@ jthomps:Thanks for your reply but remove doesnt shows me as method.It shows as namespace am i missing something.Please see the image as it shows remove not as method so how can i use it.
rmoveIssue.png
If you look at the documentation, you will see that remove() is not a static method.
Which is quite obvious, it needs some hash object to remove from.
Cheers,
_
@anda_skoa So you say the below code should show me remove() as method.
QMultiHash<int,QString> myMultiHash;
myMultiHash.remove(key);
but still it doesn't show as method.Can you help on this.
Last edited by anbu01; 9th December 2014 at 07:44.
I am not sure why code completion shows QMultiHash::remove() as a namespace. The documentation says that QMultiHash::remove() method is an overloaded function from QHash::remove(). The QHash doc explains that remove() is used to remove all items matching the key, etc.
I would recommend that as you begin to learn Qt, use the documentation as it is very complete and frequently shows examples. While I haven't noticed many issues with code completion icons that are displayed, I would use the doc as your primary learning method.
So the big question is, have you tried it and does it work for you???
anbu01 (9th December 2014)
ooops....i don't know whom to blame(Qt creator or me) actually it shows namespace icon but it works as method. Thanks for the help guys.But is this a bug in Qt creator........
Bookmarks