本文整理汇总了C++中QSet::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ QSet::remove方法的具体用法?C++ QSet::remove怎么用?C++ QSet::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSet
的用法示例。
在下文中一共展示了QSet::remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: save
Kb::~Kb(){
// Save settings first
save();
// remove the notify channel from the list of notifyPaths.
///< \todo I don't think, that notifypaths is used somewhere. So why do we have it?
/// If we do not need it, searching for an ununsed notify channel can easy be refactored to a private member function.
notifyPaths.remove(macroPath);
// Kill notification thread and remove node
activeDevices.remove(this);
if(!isOpen()){
terminate();
wait(1000);
return;
}
if(notifyNumber > 0)
cmd.write(QString("idle\nnotifyoff %1\n").arg(notifyNumber).toLatin1());
cmd.flush();
terminate();
wait(1000);
cmd.close();
}
示例2:
QSet<int> SuGame::getRowOfFiled_(std::vector<SuFieldCell> &field, int y)
{
QSet<int> row;
int beginIndex = y * LEN_SIDE_OF_FIELD;
for(int i = 0; i < LEN_SIDE_OF_FIELD; i++)
{
row.insert(field.at(beginIndex + i).value);
}
row.remove(0);
return row;
}
示例3: configureBlackEngine
void NewGameDialog::configureBlackEngine()
{
EngineConfigurationDialog dlg(EngineConfigurationDialog::ConfigureEngine, this);
int i = selectedEngineIndex(Chess::Side::Black);
const EngineConfiguration& config = m_engineManager->engineAt(i);
dlg.applyEngineInformation(config);
QSet<QString> names = m_engineManager->engineNames();
names.remove(config.name());
dlg.setReservedNames(names);
if (dlg.exec() == QDialog::Accepted)
m_engineManager->updateEngineAt(i, dlg.engineConfiguration());
}
示例4: updateVariable
static QString updateVariable(const QString &varStr, const QString &varsToAdd,
const QString &varsToRemove)
{
QSet<QString> var = parseVariable(varStr);
QSet<QString> ss = parseVariable(varsToAdd);
foreach (QString s, ss)
var << s;
ss = parseVariable(varsToRemove);
foreach (QString s, ss)
var.remove(s);
QStringList sl = QStringList::fromSet(var);
return sl.join(QLatin1String(" "));
}
示例5: unwrapShape
void ShrinkToFitShapeContainer::unwrapShape(KoShape *shape)
{
Q_ASSERT(shape->parent() == this);
removeShape(shape);
shape->setParent(parent());
QSet<KoShape*> delegates = toolDelegates();
delegates.remove(shape);
setToolDelegates(delegates);
shape->setPosition(position());
shape->setSize(size());
shape->rotate(rotation());
shape->setSelectable(true);
}
示例6:
QList<const UserBaseInformations*> FreeUser::Search(QMap<QString,AUser*>::const_iterator begin,QMap<QString,AUser*>::const_iterator end, const UserBaseInformations &inf) const
{
QSet<const UserBaseInformations*> nameSet;
QSet<const UserBaseInformations*> emailSet;
QSet<const UserBaseInformations*> resultSet;
bool set = false;
if(inf.GetName() != "")
{
for(QMap<QString,AUser*>::const_iterator it = begin;it != end ;it++)
{
if((*it)->Profile->GetName() == inf.GetName())
nameSet.insert((*it)->Profile);
}
if(!set)
{
set = true;
resultSet = nameSet;
}
}
if(inf.GetEmail() != "")
{
for(QMap<QString,AUser*>::const_iterator it = begin;it != end ;it++)
{
if((*it)->Profile->GetEmail() == inf.GetEmail())
emailSet.insert((*it)->Profile);
}
if(!set)
{
set = true;
resultSet = emailSet;
}
}
if(inf.GetName()!="")
resultSet.intersect(nameSet);
if(inf.GetEmail()!= "")
resultSet.intersect(emailSet);
//rimuovo se presente me stesso
resultSet.remove(this->Profile);
return QList<const UserBaseInformations*>::fromSet(resultSet);
}
示例7: ChildsSync
void QtPropertyDataDavaKeyedArcive::ChildsSync()
{
QSet<QtPropertyData *> dataToRemove;
// at first step of sync we mark (placing to vector) items to remove
for(int i = 0; i < ChildCount(); ++i)
{
QPair<QString, QtPropertyData *> pair = ChildGet(i);
if(NULL != pair.second)
{
dataToRemove.insert(pair.second);
}
}
// as second step we go throught keyed archive and add new data items,
// and remove deleting mark from items that are still in archive
if(NULL != curArchive)
{
DAVA::Map<DAVA::String, DAVA::VariantType*> data = curArchive->GetArchieveData();
DAVA::Map<DAVA::String, DAVA::VariantType*>::iterator i = data.begin();
for(; i != data.end(); ++i)
{
QtPropertyData *childData = ChildGet(i->first.c_str());
// this key already in items list
if(NULL != childData)
{
// remove deleting mark
dataToRemove.remove(childData);
}
// create new child data
else
{
ChildCreate(i->first.c_str(), i->second);
}
}
}
// delete all marked items
QSetIterator<QtPropertyData *> it(dataToRemove);
while(it.hasNext())
{
ChildRemove(it.next());
}
}
示例8: verify
void verify(QList<TestContext*> allContexts) {
{
DUChainReadLocker lock(DUChain::lock());
QCOMPARE(m_context->importedParentContexts().count(), imports.count());
}
//Compute a closure of all children, and verify that they are imported.
QSet<TestContext*> collected;
collectImports(collected);
collected.remove(this);
DUChainReadLocker lock(DUChain::lock());
foreach(TestContext* context, collected) {
QVERIFY(m_context->imports(context->m_context, CursorInRevision::invalid()));
#ifdef TEST_NORMAL_IMPORTS
QVERIFY(m_normalContext->imports(context->m_normalContext));
#endif
}
示例9: updateWinList
void WindowsModel::updateWinList ()
{
auto& w = Util::XWrapper::Instance ();
QSet<Window> known;
for (const auto& info : Windows_)
known << info.WID_;
auto current = w.GetWindows ();
current.erase (std::remove_if (current.begin (), current.end (),
[this, &w] (Window wid) {
return !w.ShouldShow (wid);
}), current.end ());
for (auto i = current.begin (); i != current.end (); )
{
if (known.remove (*i))
i = current.erase (i);
else
++i;
}
for (auto wid : known)
{
const auto pos = std::find_if (Windows_.begin (), Windows_.end (),
[&wid] (const WinInfo& info) {
return info.WID_ == wid;
});
const auto dist = std::distance (Windows_.begin (), pos);
beginRemoveRows ({}, dist, dist);
Windows_.erase (pos);
endRemoveRows ();
ImageProvider_->RemoveIcon (QString::number (wid));
}
if (!current.isEmpty ())
{
beginInsertRows ({}, Windows_.size (), Windows_.size () + current.size () - 1);
for (auto wid : current)
AddWindow (wid, w);
endInsertRows ();
}
}
示例10: editKeyword
void OptionsDialog::editKeyword(QListWidgetItem *item)
{
Keyword keyword;
keyword.name = item->text();
keyword.iconResource = item->data(Qt::UserRole).toString();
keyword.color = item->backgroundColor();
QSet<QString> keywordNamesButThis = keywordNames();
keywordNamesButThis.remove(keyword.name);
KeywordDialog *keywordDialog = new KeywordDialog(keyword, keywordNamesButThis, this);
if (keywordDialog->exec() == QDialog::Accepted) {
keyword = keywordDialog->keyword();
item->setIcon(QIcon(keyword.iconResource));
item->setText(keyword.name);
item->setData(Qt::UserRole, keyword.iconResource);
item->setBackgroundColor(keyword.color);
}
}
示例11: terminate
Kb::~Kb(){
activeDevices.remove(this);
if(!isOpen()){
terminate();
wait(1000);
return;
}
// Kill notification thread and remove node
if(notifyNumber > 0)
cmd.write(QString("idle\nnotifyoff %1\n").arg(notifyNumber).toLatin1());
cmd.flush();
terminate();
wait(1000);
// Reset to hardware profile
if(_hwProfile){
_currentProfile = _hwProfile;
hwSave();
}
cmd.close();
}
示例12: thread
QcepObject::~QcepObject()
{
#ifndef QT_NO_DEBUG
QThread *currTh = QThread::currentThread();
QThread *objTh = thread();
if (objTh && currTh != objTh) {
printf("Deleting object from different thread %s (%s, %s)\n",
qPrintable(objectName()),
qPrintable(currTh ? currTh->objectName() : "null"),
qPrintable(objTh ? objTh->objectName() : "null"));
}
#endif
s_ObjectDeleteCount.fetchAndAddOrdered(1);
#ifndef QT_NO_DEBUG
s_Allocated.remove(this);
#endif
}
示例13: mouseReleased
void ObjectSelectionTool::mouseReleased(QGraphicsSceneMouseEvent *event)
{
if (event->button() != Qt::LeftButton)
return;
switch (mMode) {
case NoMode:
if (mClickedObjectItem) {
QSet<MapObjectItem*> selection = mapScene()->selectedObjectItems();
const Qt::KeyboardModifiers modifiers = event->modifiers();
if (modifiers & (Qt::ShiftModifier | Qt::ControlModifier)) {
if (selection.contains(mClickedObjectItem))
selection.remove(mClickedObjectItem);
else
selection.insert(mClickedObjectItem);
} else {
selection.clear();
selection.insert(mClickedObjectItem);
}
mapScene()->setSelectedObjectItems(selection);
} else {
mapScene()->setSelectedObjectItems(QSet<MapObjectItem*>());
}
break;
case Selecting:
updateSelection(event->scenePos(), event->modifiers());
mapScene()->removeItem(mSelectionRectangle);
mMode = NoMode;
break;
case Moving:
finishMoving(event->scenePos());
break;
case Rotating:
finishRotating(event->scenePos());
break;
}
mMousePressed = false;
mClickedObjectItem = 0;
mClickedCornerHandle = 0;
}
示例14: deregisterMap
void QGeoTiledMappingManagerEngine::deregisterMap(QGeoTiledMapData *map)
{
d_ptr->tileMaps_.remove(map);
d_ptr->mapHash_.remove(map);
QHash<QGeoTileSpec, QSet<QGeoTiledMapData *> > newTileHash = d_ptr->tileHash_;
typedef QHash<QGeoTileSpec, QSet<QGeoTiledMapData *> >::const_iterator h_iter;
h_iter hi = d_ptr->tileHash_.constBegin();
h_iter hend = d_ptr->tileHash_.constEnd();
for (; hi != hend; ++hi) {
QSet<QGeoTiledMapData *> maps = hi.value();
if (maps.contains(map)) {
maps.remove(map);
if (maps.isEmpty())
newTileHash.remove(hi.key());
else
newTileHash.insert(hi.key(), maps);
}
}
d_ptr->tileHash_ = newTileHash;
}
示例15: reserve
void tst_QSet::reserve()
{
QSet<int> set;
int n = set.capacity();
QVERIFY(n == 0);
set.reserve(1000);
QVERIFY(set.capacity() >= 1000);
for (int i = 0; i < 500; ++i)
set.insert(i);
QVERIFY(set.capacity() >= 1000);
for (int j = 0; j < 500; ++j)
set.remove(j);
QVERIFY(set.capacity() >= 1000);
set.clear();
QVERIFY(set.capacity() == 0);
}