Beispiel #1
0
void QCreatableLink::setKey(plKey key)
{
    if (key.Exists()) {
        fCreatable = key.isLoaded() ? key->getObj() : NULL;
        fObjLabel->setEnabled(true);
    } else {
        fCreatable = NULL;
        fObjLabel->setEnabled(false);
    }
}
void plKeyCollector::del(plKey key) {
    std::vector<plKey>& keyList = keys[key->getLocation()][key->getType()];
    std::vector<plKey>::iterator it = keyList.begin();
    size_t sub = 0;
    while (it != keyList.end()) {
        if ((*it) == key) {
            it = keyList.erase(it);
            sub++;
        } else {
            (*it)->setID((*it)->getID() - sub);
            it++;
        }
    }
    if (keyList.empty())
        keys[key->getLocation()].erase(key->getType());
    if (keys[key->getLocation()].empty())
        keys.erase(key->getLocation());
    if (key.Exists() && key.isLoaded()) {
        key->deleteObj();
    }
}