当前位置: 首页>>代码示例>>C++>>正文


C++ QMap::erase方法代码示例

本文整理汇总了C++中QMap::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ QMap::erase方法的具体用法?C++ QMap::erase怎么用?C++ QMap::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QMap的用法示例。


在下文中一共展示了QMap::erase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: remove

/*!
  Removes the mapping from application \a app to its process id.
  \internal
 */
void OomPrivate::remove(const QString& app)
{
    if (app.isEmpty())
        return;
    int pid = 0;
    QMap<QString,int>::iterator i;
    i = important_procs_.find(app);
    if (i != important_procs_.end()) {
        pid = i.value();
        important_procs_.erase(i);
        qLog(OOM) << "Removed important proc:" << app << pid;
        return;
    }
    i = critical_procs_.find(app);
    if (i != critical_procs_.end()) {
        pid = i.value();
        critical_procs_.erase(i);
        qLog(OOM) << "Removed critical proc:" << app << pid;
        return;
    }
    i = expendable_procs_.find(app);
    if (i != expendable_procs_.end()) {
        pid = i.value();
        expendable_procs_.erase(i);
        qLog(OOM) << "Removed expendable proc:" << app << pid;
        return;
    }
}
开发者ID:Camelek,项目名称:qtmoko,代码行数:32,代码来源:oommanager.cpp

示例2:

ConfCertDialog::~ConfCertDialog()
{
    QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId);
    if (it != instances_ssl.end())
	    instances_ssl.erase(it);

    QMap<RsPgpId, ConfCertDialog*>::iterator it2 = instances_pgp.find(pgpId);
    if (it2 != instances_pgp.end())
	    instances_pgp.erase(it2);
}
开发者ID:G10h4ck,项目名称:RetroShare,代码行数:10,代码来源:ConfCertDialog.cpp

示例3:

ConfCertDialog::~ConfCertDialog()
{
//    if(peerId.isNull())
    {
        QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId);
        if (it != instances_ssl.end())
            instances_ssl.erase(it);
    }
//    else
    {
        QMap<RsPgpId, ConfCertDialog*>::iterator it = instances_pgp.find(pgpId);
        if (it != instances_pgp.end())
            instances_pgp.erase(it);
    }
}
开发者ID:WAR10CKfreeworld,项目名称:RetroShare,代码行数:15,代码来源:ConfCertDialog.cpp

示例4: prepareScreens

    void ConfigurationScreens::prepareScreens(QMap<int, OutputScreen *> & screens) {
        BackendConfiguration * config = BackendConfigurations::self()->activeBackendConfiguration();
        if (! config) {
            return;
        }

        if (config->name() == "external") {
            screens.clear();
            return;
        }

        QMap<int, QRect> layout = config->realLayout();
        for (QMap<int, QRect>::const_iterator i = layout.constBegin(); i != layout.constEnd(); ++i) {
            if (screens.contains(i.key())) {
                screens[i.key()]->_setGeom(i.value());
            } else {
                OutputScreen * screen = new OutputScreen(this);
                screen->_setId(i.key());
                screen->_setGeom(i.value());
                screens.insert(screen->id(), screen);
            }
        }

        for (QMap<int, OutputScreen *>::iterator i = screens.begin(); i != screens.end();) {
            if (! layout.contains(i.key())) {
                i = screens.erase(i);
            } else {
                ++i;
            }
        }
    }
开发者ID:aarontc,项目名称:kde-workspace,代码行数:31,代码来源:configurationscreens.cpp

示例5:

ConfCertDialog::~ConfCertDialog()
{
    QMap<std::string, ConfCertDialog*>::iterator it = instances.find(mId);
    if (it != instances.end()) {
        instances.erase(it);
    }
}
开发者ID:chozabu,项目名称:OldMeshDemocRS,代码行数:7,代码来源:ConfCertDialog.cpp

示例6: fileUnlock

/*!
    Convenience function that attempts to unlock the file with identifier \a id that was locked by \c QMail::fileLock.

    Returns \c true for success or \c false otherwise.

    \sa QMail::fileLock()
*/
bool QMail::fileUnlock(int id)
{
#ifdef Q_OS_WIN
    QMap<int, HANDLE>::iterator it = lockedFiles.find(id);
    if (it != lockedFiles.end()) {
        if (::UnlockFile(it.value(), 0, 0, 1, 0) == FALSE) {
            qWarning() << "Unable to unlock file:" << lastSystemErrorMessage();
        } else {
            if (::CloseHandle(it.value()) == FALSE) {
                qWarning() << "Unable to close handle:" << lastSystemErrorMessage();
            }

            lockedFiles.erase(it);
            return true;
        }
    }

    return false;
#else

    int result = -1;

    result = ::close(id);
    if (result == -1)
        return false;

    return true;
#endif
}
开发者ID:chriadam,项目名称:messagingframework,代码行数:36,代码来源:qmailnamespace.cpp

示例7:

extern "C" void qtns_destroy(QtNPInstance *This)
{
    QMap<QtNPInstance *, QX11EmbedWidget *>::iterator it = clients.find(This);
    if (it == clients.end())
        return;
    delete it.value();
    clients.erase(it);
}
开发者ID:PhobosK,项目名称:plexydesk,代码行数:8,代码来源:qtbrowserplugin_x11.cpp

示例8: addTranslator

bool Injector::addTranslator(QString fn) {
	if (_repMap.contains(fn))
		_repMap.erase(_repMap.find(fn));
	if (!_newTrans.contains(fn))
		_newTrans[fn] = (new QTranslator());
	return Injector::instance().Wrapper->Call_QTranslator_load(_newTrans[fn], fn, QString(), QString(), QString());
	
}
开发者ID:Yangff,项目名称:mvuccu,代码行数:8,代码来源:Injector.cpp

示例9: removeCustomField

 void removeCustomField(const QString &name)
 {
     QMap<QString, QString>::iterator it = _customFields.find(name);
     if (it != _customFields.end()) {
         _customFields.erase(it);
         _customFieldsModified = true;
     }
 }
开发者ID:qt-labs,项目名称:messagingframework,代码行数:8,代码来源:qmailaccount.cpp

示例10: clear

    static void clear(QMap<int, T*> &temp) {
        QMap<int, T*> clearMap = temp;

        typename QMap<int, T*>::iterator it;
        for(it = clearMap.begin(); it != clearMap.end(); )
        {
            SAFE_DELETE(it.value());
            clearMap.erase(it++);
        }
        clearMap.clear();
    }
开发者ID:QiumingLu,项目名称:Qt,代码行数:11,代码来源:systype.cpp

示例11: locker

ReferenceCounter::~ReferenceCounter(void)
{
    if (m_referenceCount.fetchAndAddRelaxed(0) > 1)
    {
        LOG(VB_GENERAL, LOG_ERR,
            "Object deleted with non-zero or one reference count!");
    }
#ifdef LEAK_DEBUG
    QWriteLocker locker(&leakLock);
    leakMap.erase(leakMap.find(this));
#endif
}
开发者ID:DaveDaCoda,项目名称:mythtv,代码行数:12,代码来源:referencecounter.cpp

示例12: foldNode

static void foldNode(QDomElement &docElem, QDomElement &e, QMap<QString,QDomElement> &dupeList, QString s=QString()) //krazy:exclude=passbyvalue
{
    if (s.isEmpty())
        s = e.text();
    QMap<QString,QDomElement>::iterator it = dupeList.find(s);
    if (it != dupeList.end())
    {
        kDebug(7021) << e.tagName() << "and" << s << "requires combining!";

        docElem.removeChild(*it);
        dupeList.erase(it);
    }
    dupeList.insert(s, e);
}
开发者ID:vasi,项目名称:kdelibs,代码行数:14,代码来源:vfolder_menu.cpp

示例13: removeDamageWatch

void FdoSelectionManager::removeDamageWatch(QWidget *container)
{
#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE)
    for (QMap<WId, DamageWatch*>::Iterator it = damageWatches.begin(); it != damageWatches.end(); ++it)
    {
        DamageWatch *damage = *(it);
        if (damage->container == container) {
             XDamageDestroy(QX11Info::display(), damage->damage);
             damageWatches.erase(it);
             delete damage;
             break;
        } 
    }
#endif
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:15,代码来源:fdoselectionmanager.cpp

示例14: main

int main ()
{
  QMap<char,int> myQMap;

  myQMap['a']=10;
  myQMap['b']=20;
  myQMap['c']=30;

  while (!myQMap.empty())
  {
     cout << myQMap.begin().key() << " => ";
     cout << myQMap.begin().value() << endl;
     myQMap.erase(myQMap.begin());
  }
  assert(!myQMap.empty());
  return 0;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:17,代码来源:main.cpp

示例15: fileUnlock

/*!
    Convenience function that attempts to unlock the file with identifier \a id that was locked by \c QMail::fileLock.

    Returns \c true for success or \c false otherwise.

    \sa QMail::fileLock()
*/
bool QMail::fileUnlock(int id)
{
#ifdef Q_OS_WIN
    QMap<int, HANDLE>::iterator it = lockedFiles.find(id);
    if (it != lockedFiles.end()) {
        if (::UnlockFile(it.value(), 0, 0, 1, 0) == FALSE) {
            qWarning() << "Unable to unlock file:" << lastSystemErrorMessage();
        } else {
            if (::CloseHandle(it.value()) == FALSE) {
                qWarning() << "Unable to close handle:" << lastSystemErrorMessage();
            }

            lockedFiles.erase(it);
            return true;
        }
    }

    return false;
#else
    struct flock fl;

    fl.l_type = F_UNLCK;
    fl.l_whence = SEEK_SET;
    fl.l_start = 0;
    fl.l_len = 0;

    int result = -1;

    if((result = ::fcntl(id,F_SETLK, &fl)) == -1)
        return false;

    if((result = ::close(id)) == -1)
        return false;

    return true;
#endif
}
开发者ID:Eidolian,项目名称:qt-gmail-access,代码行数:44,代码来源:qmailnamespace.cpp


注:本文中的QMap::erase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。