void QKeyList::addKey(plKey key) { QTreeWidgetItem* item = new QTreeWidgetItem(this, QStringList() << ~key->getName() << pqGetFriendlyClassName(key->getType())); item->setIcon(0, pqGetTypeIcon(key->getType())); fKeys << key; }
plKey plKeyCollector::findKey(plKey match) { plKey key; std::vector<plKey> kList = getKeys(match->getLocation(), match->getType()); for (unsigned int i=0; i < kList.size(); i++) { if (*kList[i] == *match) { key = kList[i]; break; } } return key; }
void plKeyCollector::MoveKey(plKey key, const plLocation& to) { 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()); key->setLocation(to); add(key); }
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(); } }
void QGUIRadioGroupCtrl::controlAdded(plKey ctrl) { fDefaultValue->addItem(pqGetTypeIcon(ctrl->getType()), ~ctrl->getName()); }
void plKeyCollector::add(plKey key) { keys[key->getLocation()][key->getType()].push_back(key); if (key->getID() == 0) key->setID(keys[key->getLocation()][key->getType()].size()); }