Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMultiHashIterator remove entry if QPointer.isNull()



  • I've got a QMultiHash which has got a QPointer as it's value.
    @QMultiHash<QString, QPointer<QObject> > objectList;@
    What i want to do is iterate trough each entry in this MultiHash, i've done it with QMultiHash::iterator.
    @QMultiHash<QString, QPointer<QObject> >::iterator i = objectList.find("someKey");
    while(i != objectList.end() && i.key() == "someKey"){
    // Code
    }@
    Is it possible to check for i.key().isNull() and remove only this entry from the QMultiHash objectList if it is null?

    It should be possible to search for this value in objectList by using it's uniqueKey, but it looks like i can't access the QPointer function .isNull().


Log in to reply