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


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

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


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

示例1: compileAsciiEcoFile

// "chessx.eco.txt" -> "chessx.eco", "chessx.gtm", "chessx.txt"
bool compileAsciiEcoFile(const QString& filenameIn, QString filenameOut, QString gtmFile)
{
    // Read in the ECO data
    if(!parseAsciiEcoData(filenameIn))
    {
        return false;
    }

    filenameOut = QFileInfo(filenameIn).absolutePath() + QDir::separator() + filenameOut;
    gtmFile = QFileInfo(filenameIn).absolutePath() + QDir::separator() + gtmFile;

    // Write out the main ECO file
    QFile file(filenameOut);
    file.open(QIODevice::WriteOnly);
    QDataStream sout(&file);
    sout << COMPILED_ECO_FILE_ID;
    sout << ecoPositions;
    file.close();

    // Write out the GTM (guess-the-move) ECO file
    QFile gfile(gtmFile);
    gfile.open(QIODevice::WriteOnly);
    QDataStream gout(&gfile);
    gout << COMPILED_GUESS_FILE_ID;
    gout << gtmPositions;
    gfile.close();

    ecoPositions.clear();
    gtmPositions.clear();

    return true;
}
开发者ID:madnight,项目名称:chessx,代码行数:33,代码来源:compileeco.cpp

示例2: AddTU

void XbelTree::AddTU()
{
    QDomElement *fold = new QDomElement();
    CreateHeaderFolder(fold, QString::fromUtf8("Устройство телеуправления"), TU);
    QMap<QString, QString> properties;
    properties["name"] = "address";
    AddBookmarkNode(fold, QString::fromUtf8("адрес"), "0x01", &properties);
    properties["name"] = "comport";
    AddBookmarkNode(fold, QString::fromUtf8("компорт"), "2", &properties);
    properties["name"] = "begin_TU";
    properties["ico"] = ":/images/code.png";
    AddBookmarkNode(fold, QString::fromUtf8("адресное пространство ТУ - начало"), "0x0000", &properties);
    properties["name"] = "end_TU";
    properties["ico"] = ":/images/code.png";
    AddBookmarkNode(fold, QString::fromUtf8("адресное пространство ТУ - окончание"), "0x0009", &properties);
    properties.clear();
    properties["name"] = "proto";
    properties["variants"] = "MODBUS|DCON";
    AddBookmarkNode(fold, QString::fromUtf8("протокол"), "MODBUS", &properties);
    properties.clear();
    properties["name"] = "tic";
    properties["ico"] = ":/images/cycle.png";
    AddBookmarkNode(fold, QString::fromUtf8("Время удержания реле(DCON)"), "10", &properties);
    Reset();
    emit(MessageToStatusBar(QString::fromUtf8("Добавлено устройство ТУ")));
}
开发者ID:ejenfransuavidok,项目名称:configurator,代码行数:26,代码来源:xbeltree.cpp

示例3: _clearConfig

/**
 * @short Clears config vars
 * @author Rene Schmidt <[email protected]>
 * @version 0.1
 */
void KLAid::_clearConfig()
{
  _pCount = 0;
  mapIdx = 0;
  iTitles.clear();
  iTexts.clear();
}
开发者ID:rene-s,项目名称:KdeLearningAid,代码行数:12,代码来源:klaid.cpp

示例4: cleanup

void Ut_VolumeControl::cleanup()
{
    delete volumeControl;
    acquireCalled = false;
    releaseCalled = false;
    qTimerStartCounts.clear();
    qTimerStopCounts.clear();
    disconnect(SIGNAL(timeout()));
}
开发者ID:zchydem,项目名称:lipstick,代码行数:9,代码来源:ut_volumecontrol.cpp

示例5: AddMQ

void XbelTree::AddMQ() {
    QDomElement *fold = new QDomElement();
    CreateHeaderFolder(fold, QString::fromUtf8("Счетчик электроэнергии Меркурий"), MERQURY);
    QMap<QString, QString> properties;
    properties["name"] = "address";
    AddBookmarkNode(fold, QString::fromUtf8("адрес"), "0x01", &properties);
    properties["name"] = "comport";
    AddBookmarkNode(fold, QString::fromUtf8("компорт"), "2", &properties);
    properties["name"] = "cycle";
    AddBookmarkNode(fold, QString::fromUtf8("цикл опроса"), "3000", &properties);
    properties["name"] = "mqpassword";
    AddBookmarkNode(fold, QString::fromUtf8("пароль"), "000000", &properties);
    QString characteristics[23][5] = {
        {QString::fromUtf8("Напряжения"),                   "U",  "potential",  "folder",   ""},
        {QString::fromUtf8("Напряжение фазы A"),            "UA", "potential",  "clicked",  ":/images/U.png"},
        {QString::fromUtf8("Напряжение фазы B"),            "UB", "potential",  "clicked",  ":/images/U.png"},
        {QString::fromUtf8("Напряжение фазы C"),            "UC", "potential",  "clicked",  ":/images/U.png"},
        {QString::fromUtf8("Токи"),                         "I",  "current",    "folder",   ""},
        {QString::fromUtf8("Ток фазы A"),                   "IA", "current",    "clicked",  ":/images/I.png"},
        {QString::fromUtf8("Ток фазы B"),                   "IB", "current",    "clicked",  ":/images/I.png"},
        {QString::fromUtf8("Ток фазы C"),                   "IC", "current",    "clicked",  ":/images/I.png"},
        {QString::fromUtf8("Активные мощности"),            "P",  "power-A",    "folder",   ""},
        {QString::fromUtf8("Активная мощность фазы A"),     "PA", "power-A",    "clicked",  ":/images/P.png"},
        {QString::fromUtf8("Активная мощность фазы B"),     "PB", "power-A",    "clicked",  ":/images/P.png"},
        {QString::fromUtf8("Активная мощность фазы C"),     "PC", "power-A",    "clicked",  ":/images/P.png"},
        {QString::fromUtf8("Суммарная активная мощность"),  "SP", "power-A",    "clicked",  ":/images/P.png"},
        {QString::fromUtf8("Реактивные мощности"),          "Q",  "power-Q",    "folder",   ""},
        {QString::fromUtf8("Реактивная мощность фазы A"),   "QA", "power-Q",    "clicked",  ":/images/Q.png"},
        {QString::fromUtf8("Реактивная мощность фазы B"),   "QB", "power-Q",    "clicked",  ":/images/Q.png"},
        {QString::fromUtf8("Реактивная мощность фазы C"),   "QC", "power-Q",    "clicked",  ":/images/Q.png"},
        {QString::fromUtf8("Суммарная реактивная мощность"),"SQ", "power-Q",    "clicked",  ":/images/Q.png"},
        {QString::fromUtf8("Полные мощности"),              "S",  "power-S",    "folder",   ""},
        {QString::fromUtf8("Полная мощность фазы A"),       "SA", "power-S",    "clicked",  ":/images/S.png"},
        {QString::fromUtf8("Полная мощность фазы B"),       "SB", "power-S",    "clicked",  ":/images/S.png"},
        {QString::fromUtf8("Полная мощность фазы C"),       "SC", "power-S",    "clicked",  ":/images/S.png"},
        {QString::fromUtf8("Суммарная полная мощность"),    "SS", "power-S",    "clicked",  ":/images/S.png"},
    };
    QDomElement folder;
    for(int i=0; i<23; i++) {
        if( characteristics[i][3] == "folder" ) {
            properties.clear();
            properties["name"] = characteristics[i][2];
            folder = AddFolderNode(fold, characteristics[i][0], &properties);
        }
        else {
            properties.clear();
            properties["name"] = characteristics[i][2];
            properties["property"] = characteristics[i][3];
            properties["phase"] = characteristics[i][1];
            properties["ico"] = characteristics[i][4];
            AddBookmarkNode(&folder, characteristics[i][0], "", &properties);
        }
    }
    Reset();
    emit(MessageToStatusBar(QString::fromUtf8("Добавлено устройство Меркурий")));
}
开发者ID:ejenfransuavidok,项目名称:configurator,代码行数:56,代码来源:xbeltree.cpp

示例6: ReadStream

void FrameReader::ReadStream()
{
	Openchunk *invoice = qobject_cast<Openchunk *>(sender());
  if (!invoice) {
		return;
	}
	if (!invoice->validpng) {
		QMessageBox::warning(0, tr("Error on reader."),tr("Error say:%1").arg(invoice->error()));
	return;
	}
	////////qDebug() << "### valid image...say .." << invoice->error();
	//////qDebug() << "### valid image...say .." << invoice->validpng;
	QMap<int,APNGFRAME> framlist = invoice->list();
	QMap<int,APNGFRAME> readylist;
	readylist.clear();
	if (QThread::currentThread() == qApp->thread()) {
     qDebug() << "### can paint .." << framlist.size();
	   QMapIterator<int,APNGFRAME> i(framlist);
		 int rec = -1;
         while (i.hasNext()) {
                i.next();
					       APNGFRAME one = i.value();
					     if (one.item.isNull()) {
					       QImage tmpe;
					       QImage Pvidi(one.maxframe.width(),one.maxframe.height(),QImage::Format_ARGB32);
					       if (tmpe.loadFromData(one.dimg)) {
								 QPainter p(&Pvidi);
								 p.setRenderHint(QPainter::Antialiasing, true);
								 p.setBrush(one.bg);
								 p.drawRect(one.maxframe);
								 p.drawImage(one.point,tmpe);
								 p.end();
								 one.item = Pvidi;
								 ///////qDebug() << "### isNull() out theard .." << one.item.isNull();
								 readylist.insert(rec++,one);
								 }
							 }
				 }
  }
	if (readylist.size() > 0 ) {
		movie = readylist;
		framlist.clear();
	} else {
		movie = framlist;
	}
	if (movie.size() < 1) {
	buffer->LoadFile(qfile); /* stay on buffer to save  */
	} else {
		current = 0;
		running = true;
		ValidApng = true;
		disconnect(this);
		NextFrame();
	}
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:55,代码来源:apngreader.cpp

示例7: k

QList<QVariantMap > HsMenuClientPrivate::getList(const QVariantMap &queryPreference)
{
    QList<QVariantMap> list;
    QMap<QString, QVariant> map = queryPreference;
    
    map.remove(hsItemName);
    map.remove(hsItemDescription);
    
    CaQuery query;
    // define query
    query.setFlagsOn(VisibleEntryFlag);
    query.setEntryRoles(ItemEntryRole);
    query.setEntryTypeNames(QStringList(Hs::templatedApplicationTypeName));
    
    
    // add atributes to caquery
    QMapIterator<QString, QVariant> k(map);
    while (k.hasNext()) {
        k.next();
        query.setAttribute(k.key(),k.value().toString());
    }  
    QList< QSharedPointer<CaEntry> > entries = CaService::instance()->getEntries(query);
    map.clear();
    if (entries.count()) {
        QMap<QString, QString> attrMap;
        QMapIterator<QString, QString> k(attrMap);
        //walk trought entrys and extract keys into map
        for (int i = 0; i < entries.count(); ++i) {
            map[hsItemId] = entries.at(i)->id();
            map[hsItemName] = entries.at(i)->text();
            map[hsItemDescription] = entries.at(i)->description();
            CaIconDescription iconDesc = entries.at(i)->iconDescription();
            map[hsIconFileName] = iconDesc.filename();
            map[hsIconName] = iconDesc.skinId();
            map[hsIconApplicationId] = iconDesc.applicationId();
            
            // extract entry atributes
            attrMap = entries.at(i)->attributes();
            QMapIterator<QString, QString> k(attrMap);
            // insert entrys attr into map
            while (k.hasNext()) {
                k.next();
                map.insert(k.key(),k.value());
            }
            list.append(map); //append entry map to list
            // clean used maps
            map.clear();
            attrMap.clear();
        }
    }
    return list;
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:52,代码来源:hsmenuclient.cpp

示例8: parser

void parser(const QByteArray &text) {
    QStringList systemWords;
    systemWords << "mainpassword" << "login";
    QStringList localWords;
    localWords << "password" << "login" << "email";
    QList<QByteArray> s = text.split('\n');
    bool systemFlag = true;
    bool systemCounter = false;
    bool localFlag = false;
    bool localCounter = false;
    QMap<QString, QString> localMap;
    QMap<QString, QString> systemMap;
    QList< QMap<QString, QString> > systemList;
    QList< QMap<QString, QString> > sitesList;
    int i = 0;
    while(i < s.size() - 1) {
        QList<QByteArray> l;
        l.append(s[i].split(':'));
        QString key = QString(l.at(0));
        QString value = QString(l.at(1));
        if(systemFlag) {
            if(!systemCounter) {
                QString local = "";
                foreach(local, systemWords) {
                    if(local == key && key != QString("system")) systemMap[key] = value;
                }
                if(value == QString("end")) systemCounter = true;
            }
            if( !systemMap.isEmpty() && systemCounter) {
                systemList.append(systemMap);
                systemMap.clear();
                systemCounter = false;
            }
        }
        if (localFlag) {
            if(!localCounter) {
                QString local = "";
                if(value == QString("start")) localMap["site"] = key;
                foreach(local, localWords) {
                    if(local == key && value != QString("end") && value!=QString("start")) {
                        localMap[key] = value;
                    }
                }
                if(value == QString("end")) localCounter = true;
            }
            if(!localMap.isEmpty() && localCounter) {
                sitesList.append(localMap);
                localMap.clear();
                localCounter = false;
            }
        }
开发者ID:MarcSky,项目名称:parserQt,代码行数:51,代码来源:main.cpp

示例9: calculateMaxColumnWidths

bool QgsComposerTable::calculateMaxColumnWidths( QMap<int, double>& maxWidthMap, const QList<QgsAttributeMap>& attributeMaps ) const
{
  maxWidthMap.clear();
  QList<QgsComposerTableColumn*>::const_iterator columnIt = mColumns.constBegin();

  int col = 0;
  for ( ; columnIt != mColumns.constEnd(); ++columnIt )
  {
    maxWidthMap.insert( col, textWidthMillimeters( mHeaderFont, ( *columnIt )->heading() ) );
    col++;
  }

  //go through all the attributes and adapt the max width values
  QList<QgsAttributeMap>::const_iterator attIt = attributeMaps.constBegin();

  double currentAttributeTextWidth;

  for ( ; attIt != attributeMaps.constEnd(); ++attIt )
  {
    QgsAttributeMap::const_iterator attIt2 = attIt->constBegin();
    for ( ; attIt2 != attIt->constEnd(); ++attIt2 )
    {
      currentAttributeTextWidth = textWidthMillimeters( mContentFont, attIt2.value().toString() );
      if ( currentAttributeTextWidth > maxWidthMap[ attIt2.key()] )
      {
        maxWidthMap[ attIt2.key()] = currentAttributeTextWidth;
      }
    }
  }
  return true;
}
开发者ID:Aladar64,项目名称:QGIS,代码行数:31,代码来源:qgscomposertable.cpp

示例10: loadSavedGame

void MagicTowerLoader::loadSavedGame(const QString& directoryName, const QString& saveName)
{
    scene->reset();
    loadMap(directoryName + "/" + saveName + ".mtsavedmap.ini");
    QFile extraFile(directoryName + "/" + saveName + ".mtsavedextra.ini");
    extraFile.open(QFile::ReadOnly);
    QTextStream extraFileStream(&extraFile);
    QString className;
    QMap<QString, QString> parameters;
    for(;;)
    {
        QString str = extraFileStream.readLine();
        str = str.trimmed();
        if(extraFileStream.atEnd() || (str.startsWith("[")&&str.endsWith("]")))
        {
            if(className.size()>0)
            {
                if(className == "Character")
                {
                    QString map = parameters["map"];
                    int x = parameters["x"].toInt();
                    int y = parameters["y"].toInt();
                    scene->setObjectAt(map,"character",x,y,getPreset<MagicTowerCharacter>("warrior")->clone());
                    MagicTowerCharacter* character = dynamic_cast<MagicTowerCharacter*>(
                                scene->getObjectAt(map,"character",x,y));
                    if(character!=NULL)
                    {
                        QMap<QString, QString>::const_iterator i = parameters.begin();
                        while (i != parameters.end())
                        {
                            if(i.key()=="x"||i.key()=="y"||i.key()=="map")
                            {
                                i++;
                                continue;
                            }
                            character->setGameProperty(i.key(),i.value().toInt());
                            i++;
                        }
                        scene->setActiveCharacter(character);
                    }
                }
                parameters.clear();
            }
            str[0] = QChar(' ');
            str[str.size()-1] = QChar(' ');
            str = str.trimmed();
            className = str;
        }
        else if(str.size()>0)
        {
            QStringList lineParts = str.split("=");
            if(lineParts.size()==2)
            {
                parameters[lineParts[0].trimmed()] = lineParts[1].trimmed();
            }
        }
        if(extraFileStream.atEnd()) break;
    }
    extraFile.close();
}
开发者ID:SLGMaker,项目名称:SLG_Maker,代码行数:60,代码来源:MagicTowerLoader.cpp

示例11: createUpdatedEntries

void FacebookContactsDatabasePrivate::createUpdatedEntries(const QMap<QString, QMap<QString, QVariant> > &input,
                                                           const QString &primary,
                                                           QMap<QString, QVariantList> &entries)
{
    entries.clear();

    // Check if we have the same data
    QStringList keys;
    foreach (const QVariantMap &inputEntry, input) {
        // TODO: instead of return, we should only insert entries that "works" to
        // the list.
        if (inputEntry.isEmpty()) {
            return;
        }

        if (keys.isEmpty()) {
            keys = inputEntry.keys();
        } else if (inputEntry.keys() != keys) {
            return;
        }
    }

    foreach (const QString &key, keys) {
        entries.insert(key, QVariantList());
    }
开发者ID:adenexter,项目名称:libsocialcache,代码行数:25,代码来源:facebookcontactsdatabase.cpp

示例12: resetRepository

void TimeStamp::resetRepository()
{
	registry.clear();
	TZFile tzf;tzf.setName("UTC");
	registry.insert("UTC",tzf);
	setDefaultZone(defaultzone);
}
开发者ID:Nikoli,项目名称:qlandkartegt,代码行数:7,代码来源:tzdata.cpp

示例13: commitToTemplate

void LairTool::commitToTemplate() {
    if (currentTemplate == NULL)
        return;

    currentTemplate->setSpawnLimit(ui->spinBox->value());

    QMap<QString, uint32>* mobiles = currentTemplate->getMobiles();
    mobiles->clear();

    for (int i = 0; i < ui->listWidget_mobiles->count(); ++i) {
        QListWidgetItem* item = ui->listWidget_mobiles->item(i);

        QString data = item->text();

        QString mobile = data.section('\t', 0, 0);
        QString level = data.section('\t', 1, 1);

        mobiles->insert(mobile, level.toInt());
    }

    commitBuildings(ui->listWidget_veryEasy, LairTemplate::VERYEASY);
    commitBuildings(ui->listWidget_easy, LairTemplate::EASY);
    commitBuildings(ui->listWidget_Medium, LairTemplate::MEDIUM);
    commitBuildings(ui->listWidget_Hard, LairTemplate::HARD);
    commitBuildings(ui->listWidget_veryHard, LairTemplate::VERYHARD);
}
开发者ID:Mesagoppinmypants,项目名称:Tools,代码行数:26,代码来源:lairtool.cpp

示例14: oStream

// +-----------------------------------------------------------
bool f3::LogControl::getAppLogData(QMap<QString, QtMsgType> &mAppLogData) const
{
	// Try to lock the shared memory
	if(!m_pSharedMemory->lock())
		return false;

	// Read the map from the shared memory
	QBuffer oBuffer;
	QDataStream oStream(&oBuffer);

	oBuffer.setData((char *) m_pSharedMemory->constData(), m_pSharedMemory->size());
	oBuffer.open(QBuffer::ReadOnly);
	
	QMap<QString, int> mApps;
	oStream >> mApps;

	// Unlock the shared memory before returning
	m_pSharedMemory->unlock();

	mAppLogData.clear();
	QMap<QString, int>::iterator it;
	for(it = mApps.begin(); it != mApps.end(); ++it)
		mAppLogData.insert(it.key(), (QtMsgType) (it.value() - 1));

	return true;
}
开发者ID:luigivieira,项目名称:F3,代码行数:27,代码来源:logcontrol.cpp

示例15: getCookie

void getCookie(const QByteArray &input,QMap<QString,QString> &output)
{
    output.clear();
    QString s=QString::fromLatin1(input,input.size());
    QRegExp m("(\r\n|\n){2,}");
    int itemp=m.indexIn(s);
    if(itemp >=0)
    {
        s=s.left(itemp);
    }
    QStringList slist=s.split(QRegExp("\r\n|\n"));
    QRegExp m1("Set-Cookie:\\s+(.*)=(.*);");
    m1.setMinimal(true);
    int c=slist.count();
    for(int i=0;i<c;i++)
    {
        if((itemp=m1.indexIn(slist[i]))>=0)
        {
            output.insert(m1.cap(1),m1.cap(2));
//            qDebug()<<m1.cap(1)<<m1.cap(2)<<m1.cap(3)<<m1.cap(4);
        }
    }


}
开发者ID:daddyreb,项目名称:Bigit_Genie,代码行数:25,代码来源:SvtFcml.cpp


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