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


C++ QMapIterator::key方法代码示例

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


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

示例1: setFieldValue

/**
\param val
**/
void BlSearchWidget::setFieldValue ( QString campo, QString val )
{
    BL_FUNC_DEBUG
    BlDebug::blDebug ( "BlSearchWidget::setcifprofesor", 0, val );

    QString SQLQuery("");
    SQLQuery = "SELECT * FROM " + m_tabla + " WHERE " + campo + " = $1";
    BlDbRecordSet *cur = mainCompany() ->load ( SQLQuery, val );

    if ( !cur->eof() ) {
        /// Inicializamos los valores de vuelta a ""
        QMapIterator<QString, QString> i ( m_valores );
        while ( i.hasNext() ) {
            i.next();
            m_valores.insert ( i.key(), cur->value( i.key() ) );
        } // end while
    } else {
        /// Inicializamos los valores de vuelta a ""
        QMapIterator<QString, QString> i ( m_valores );
        while ( i.hasNext() ) {
            i.next();
            m_valores.insert ( i.key(), "" );
        } // end while
    } // end if
    delete cur;
    pinta();
    
}
开发者ID:trifolio6,项目名称:Bulmages,代码行数:31,代码来源:blsearchwidget.cpp

示例2: colorList

void ReportWindow::colorList() {

    //
    // ADD CODE HERE TO CHECK FOR CHANGES TO DOCUMENT
    //
    QMap<QString, QColor> cm = _colorMap;
    ColorList cl(this);
    cl.init(&_colorMap);
    cl.exec();
    if(cm.count() == _colorMap.count()) {
        // the two lists have the same number of items so
        // we will have to check each item for equality
        // to see if a change was made
        QMapIterator<QString, QColor> cit;
        for(cit = cm.begin(); cit != cm.end(); ++cit) {
            if(!_colorMap.contains(cit.key()) || _colorMap[cit.key()] != cm[cit.key()]) {
                setModified(TRUE);
                break;
            }
        }
    } else {
        // they don't have the same number of items
        // so we can just assume the list was changed
        setModified(TRUE);
    }
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:26,代码来源:reportwindow.cpp

示例3: generateBindingOfTheRegister

QString FRegister::generateBindingOfTheRegister()
{
    QString code = "";

    QStringList keyList;
    QString name = this->attributes().value("name").toString();
    QMapIterator<QString, QVariant> iterator (this->attributes());
    while(iterator.hasNext())
    {
        iterator.next();
        if(iterator.key() != "name" && iterator.key() != "registrator")
        {
            keyList.append(iterator.key());
        }
    }
    code += "function register_" + name + "_Binding(x)\n{\n\nthis.object = x;\nthis.map = x.attributes();\n";
    for(int i=0; i<keyList.size(); i++)
    {
        code += "this." + keyList[i] + ";\n";// + " = Current_" + keyList[i] + ";\n";
    }

    code += "this.Write = function()\n{\n";
    for(int i=0; i<keyList.size(); i++)
    {
        code += "this.object.setAttribute(\"" + keyList[i] + "\", this." + keyList[i] + ");\n";
    }
    code += "}\n";

    code += "this.Add = function()\n{\n";
    for(int i=0; i<keyList.size(); i++)
    {
        code += "this.object.setAttribute(\"" + keyList[i] + "\", \"\");\n";
    }
    code += "return this;\n";
    code += "}\n";

    code += "}\n";
    //code += "var " + name + " = new register_" + name + "_Binding(" + name + ");\n";

    QFile file ("./scripts/binding" + name + ".qs");
    if(file.open(QIODevice::WriteOnly))
    {
        QTextStream stream (&file);
        stream<<code;
    }
    file.close();

    return code;
}
开发者ID:DimaRomanyuk,项目名称:QEF,代码行数:49,代码来源:fregister.cpp

示例4: splitByAnchors

void LocationTable::splitByAnchors(const PreprocessedContents& text, const Anchor& textStartPosition, QList<PreprocessedContents>& strings, QList<Anchor>& anchors) const {

  Anchor currentAnchor = Anchor(textStartPosition);
  size_t currentOffset = 0;

  QMapIterator<std::size_t, Anchor> it = m_offsetTable;

  while (currentOffset < (size_t)text.size())
  {
    Anchor nextAnchor(KDevelop::CursorInRevision::invalid());
    size_t nextOffset;

    if(it.hasNext()) {
      it.next();
      nextOffset = it.key();
      nextAnchor = it.value();
    }else{
      nextOffset = text.size();
      nextAnchor = Anchor(KDevelop::CursorInRevision::invalid());
    }

    if( nextOffset-currentOffset > 0 ) {
      strings.append(text.mid(currentOffset, nextOffset-currentOffset));
      anchors.append(currentAnchor);
    }

    currentOffset = nextOffset;
    currentAnchor = nextAnchor;
  }
}
开发者ID:alstef,项目名称:kdevelop,代码行数:30,代码来源:pp-location.cpp

示例5: wit

//---------------------------------------------------------------------------
//  getWordItems
//
//! Construct a list of word items to be inserted into a word list, based on
//! the results of a list of searches.
//
//! @param searchSpecs the list of search specifications
//! @return a list of word items
//---------------------------------------------------------------------------
QList<WordTableModel::WordItem>
WordVariationDialog::getWordItems(const QList<SearchSpec>& searchSpecs) const
{
    QList<WordTableModel::WordItem> wordItems;
    QMap<QString, QString> wordMap;
    QListIterator<SearchSpec> lit (searchSpecs);
    while (lit.hasNext()) {
        QStringList wordList = wordEngine->search(lexicon, lit.next(), false);
        QStringListIterator wit (wordList);
        while (wit.hasNext()) {
            QString str = wit.next();
            wordMap.insert(str.toUpper(), str);
        }
    }

    QMapIterator<QString, QString> mit (wordMap);
    while (mit.hasNext()) {
        mit.next();
        QString value = mit.value();
        QList<QChar> wildcardChars;
        for (int i = 0; i < value.length(); ++i) {
            QChar c = value[i];
            if (c.isLower())
                wildcardChars.append(c);
        }
        QString wildcard;
        if (!wildcardChars.isEmpty()) {
            qSort(wildcardChars.begin(), wildcardChars.end(),
                  Auxil::localeAwareLessThanQChar);
            foreach (const QChar& c, wildcardChars)
                wildcard.append(c.toUpper());
        }
        wordItems.append(WordTableModel::WordItem(
            mit.key(), WordTableModel::WordNormal, wildcard));
    }
开发者ID:LyndaFinn,项目名称:zyzzyva-pc,代码行数:44,代码来源:WordVariationDialog.cpp

示例6: storeClass

void Emotions::storeClass(QString klassName, NaiveBayesClassifier *classifier){
    double acc=0;
    if(klassName.contains("calm") || klassName.contains("exited")){
        acc=EMOTION_AROUSAL_ACCURACY;
    }else if(klassName.contains("positive") || klassName.contains("negative")){
        acc=EMOTION_VALENCE_ACCURACY;
    }else{
        return;
    }

    if(classifier->getTrainedClasses().contains(klassName)){
        QFile file(_dataPath+"."+klassName);
        if (!file.open(QIODevice::WriteOnly)) {
            qDebug() << "Emotions : cannot open file "+file.fileName()+" : "
                     << qPrintable(file.errorString()) << file.fileName()<< endl;
            return;
        }

        QMapIterator<double, double>* clasIt = new QMapIterator<double,double>(*classifier->getTrainedClasses().value(klassName));
        while(clasIt->hasNext()){
            clasIt->next();
            for(int j=0;j<clasIt->value();++j){
                QString* strVal=new QString("");
                strVal->setNum(clasIt->key(),'f', acc);
                file.write(strVal->toAscii());
                file.putChar('\n');
            }
        }
    }
}
开发者ID:sinlab-semester-2013,项目名称:PocketBrain,代码行数:30,代码来源:emotions.cpp

示例7: closestCurve

int Plot::closestCurve(int xpos, int ypos, int &dist, int &point)
{
QwtScaleMap map[QwtPlot::axisCnt];
for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
	map[axis] = canvasMap(axis);

double dmin = 1.0e10;
int key = -1;
for (QMapIterator<int, QwtPlotCurve *> it = d_curves.begin(); it != d_curves.end(); ++it ) 
	{
	QwtPlotCurve *c = (QwtPlotCurve *)it.data();
	if (!c)
		continue;

	for (int i=0; i<c->dataSize(); i++)
		{
		double cx = map[c->xAxis()].xTransform(c->x(i)) - double(xpos);
		double cy = map[c->yAxis()].xTransform(c->y(i)) - double(ypos);
		double f = qwtSqr(cx) + qwtSqr(cy);
		if (f < dmin)
			{
			dmin = f;
			key = it.key();
			point = i;
			}
		 }
	}
dist = int(sqrt(dmin));
return key;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:30,代码来源:plot.cpp

示例8: exportProperties

void SingleXmlSerializer::exportProperties(const Id&id, QDomDocument &doc, QDomElement &root
		, QHash<Id, Object *> const &objects)
{
	QDomElement props = doc.createElement("properties");

	const GraphicalObject * const graphicalObject = dynamic_cast<const GraphicalObject *>(objects[id]);
	const LogicalObject * const logicalObject
			= dynamic_cast<const LogicalObject *>(objects[graphicalObject->logicalId()]);

	QMap<QString, QVariant> properties;

	QMapIterator<QString, QVariant> i = logicalObject->propertiesIterator();
	while (i.hasNext()) {
		i.next();
		properties[i.key()] = i.value();

	}

	i = graphicalObject->propertiesIterator();
	while (i.hasNext()) {
		i.next();
		properties[i.key()] = i.value();
	}

	foreach (const QString &key, properties.keys()) {
		QDomElement prop = doc.createElement("property");

		QString typeName = properties[key].typeName();
		QVariant value = properties[key];
		if (typeName == "qReal::IdList" && (value.value<IdList>().size() != 0)) {
			QDomElement list = ValuesSerializer::serializeIdList("list", value.value<IdList>(), doc);
			prop.appendChild(list);
		} else if (typeName == "qReal::Id"){
			prop.setAttribute("value", value.value<Id>().toString());
		} else if (value.toString().isEmpty()) {
			continue;
		} else {
			prop.setAttribute("value", properties[key].toString());
		}

		prop.setAttribute("name", key);

		props.appendChild(prop);
	}

	root.appendChild(props);
}
开发者ID:Antropovi,项目名称:qreal,代码行数:47,代码来源:singleXmlSerializer.cpp

示例9: dump

void LocationTable::dump() const
{
  QMapIterator<std::size_t, Anchor> it = m_offsetTable;
  qCDebug(RPP) << "Location Table:";
  while (it.hasNext()) {
    it.next();
    qCDebug(RPP) << it.key() << " => " << it.value().castToSimpleCursor();
  }
}
开发者ID:alstef,项目名称:kdevelop,代码行数:9,代码来源:pp-location.cpp

示例10: clicked

void
QDialogButtons::handleClicked()
{
    const QObject *s = sender();
    if(!s)
	return;

    for(QMapIterator<QDialogButtons::Button, QWidget *> it = d->buttons.begin(); it != d->buttons.end(); ++it) {
	if(it.data() == s) {
	    emit clicked((QDialogButtons::Button)it.key());
	    switch(it.key()) {
	    case Retry:
		emit retryClicked();
		break;
	    case Ignore:
		emit ignoreClicked();
		break;
	    case Abort:
		emit abortClicked();
		break;
	    case All:
		emit allClicked();
		break;
	    case Accept:
		emit acceptClicked();
		break;
	    case Reject:
		emit rejectClicked();
		break;
	    case Apply:
		emit applyClicked();
		break;
	    case Help:
		emit helpClicked();
		break;
	    default:
		break;
	    }
	    return;
	}
    }
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:42,代码来源:qdialogbuttons.cpp

示例11:

QHash<QString, QVariant> RefactoringApplier::properties(Id const &id) const
{
	QHash<QString, QVariant> result;

	QMapIterator<QString, QVariant> properties =
			(mLogicalModelApi.isLogicalId(id))
			? mLogicalModelApi.logicalRepoApi().propertiesIterator(id)
			: mLogicalModelApi.logicalRepoApi().propertiesIterator(
					mGraphicalModelApi.logicalId(id));

	while (properties.hasNext()) {
		properties.next();

		if (!defaultProperties.contains(properties.key())) {
			result.insert(properties.key(), properties.value());
		}
	}

	return result;
}
开发者ID:qreal,项目名称:qreal,代码行数:20,代码来源:refactoringApplier.cpp

示例12: exec

bool MSqlQuery::exec()
{
    // Database connection down.  Try to restart it, give up if it's still
    // down
    if (!m_db)
    {
        // Database structure's been deleted
        return false;
    }

    if (!m_db->isOpen() && !m_db->Reconnect())
    {
        LOG(VB_GENERAL, LOG_INFO, "MySQL server disconnected");
        return false;
    }

    bool result = QSqlQuery::exec();

    // if the query failed with "MySQL server has gone away"
    // Close and reopen the database connection and retry the query if it
    // connects again
    if (!result && QSqlQuery::lastError().number() == 2006 && m_db->Reconnect())
        result = QSqlQuery::exec();

    if (VERBOSE_LEVEL_CHECK(VB_DATABASE) && logLevel <= LOG_DEBUG)
    {
        QString str = lastQuery();

        // Database logging will cause an infinite loop here if not filtered
        // out
        if (!str.startsWith("INSERT INTO logging "))
        {
       	    // Sadly, neither executedQuery() nor lastQuery() display
            // the values in bound queries against a MySQL5 database.
            // So, replace the named placeholders with their values.

            QMapIterator<QString, QVariant> b = boundValues();
            while (b.hasNext())
            {
                b.next();
                str.replace(b.key(), '\'' + b.value().toString() + '\'');
            }

            LOG(VB_DATABASE, LOG_DEBUG,
                QString("MSqlQuery::exec(%1) %2%3")
                        .arg(m_db->MSqlDatabase::GetConnectionName()).arg(str)
                        .arg(isSelect() ? QString(" <<<< Returns %1 row(s)")
                                              .arg(size()) : QString()));
        }
    }

    return result;
}
开发者ID:Openivo,项目名称:mythtv,代码行数:53,代码来源:mythdbcon.cpp

示例13: usedValues

/*!
  Lists values used during initialization
*/
QStringList TEIniFile::usedValues()
{
  QStringList sl;
  QMapIterator<QString, type_ValueList> it;
  for(it=SectionListDef.begin();it!=SectionListDef.end();++it)
  {
    type_ValueListIterator it1;
    for(it1=(*it).begin();it1!=(*it).end();++it1)
      sl << it.key()+"->"+it1.key();
  }
  return sl;
}
开发者ID:app,项目名称:tradeequip,代码行数:15,代码来源:teinifile.cpp

示例14: tuiLaunched

void ClientPrivate::tuiLaunched () {
    qDebug () << "ClientPrivate::tuiLaunched";
    QMapIterator<QString, Transfer *> iter (transfers);

    if (transfers.count() == 0) {
        // There are no transfers
        return;
    }

    while (iter.hasNext()) {
        iter.next();
        Transfer *transfer = iter.value ();

        if (iter.key() != transfer->transferId ()) {
            qCritical () <<
                "Client::tuiLaunched -> Key does not match transfer id";
        }

        QDBusReply<bool> exists =
            interface->transferExists (transfer->transferId ());
        if (exists.isValid ()) {
            if (exists.value () == true) {
                qDebug() << transfer->transferId () << "exists in TUI"
                    << "- not registering this. Moving to next";

                // Transfer exists in TUI - go to next transfer
                continue;
            }
        } else {
            qCritical() << "Got invalid reply when checking if transfer "
                << transfer->transferId () << " exists in TUI";
            continue;
        }

        QDBusReply<QString> reply =
            interface->registerTransientTransfer (transfer->transferId ());

        if (reply.isValid()) {
            if (reply.value () == transfer->transferId ()) {
                transfer->tuiLaunched ();
            } else {
                qCritical() << "Got " << reply.value () <<
                    " as reply from registerPersistentTransfer instead of "
                    << "expected value of " << transfer->transferId ();
            }
        } else {
            qWarning() << "Transfer with tracker uri" << transfer->transferId ()
                << "not found.";
        }
    }
}
开发者ID:chegestar,项目名称:Share-UI,代码行数:51,代码来源:client.cpp

示例15: pinta

/** Esta funcion lanza un signal avisando de que se ha cambiado el id. Y debe tenerse en cuenta que el
    id puede estar vacio ya que tambien se puede haber borrado el que estaba puesto.
**/
void BlSearchWidget::pinta()
{
    BL_FUNC_DEBUG
    m_semaforo = TRUE;
    QString cad = "";

    if (m_mask == "") {
      
	/// Iteramos y concatenamos"
	QMapIterator<QString, QString> i ( m_valores );
	if ( i.hasNext() ) {
	    i.next();
	    m_inputBusqueda->setText ( m_valores[i.key() ] );
	} // end if
	while ( i.hasNext() ) {
	    i.next();
	    cad = cad + " " + m_valores.value ( i.key() );
	}

    } else {
      
	cad = m_mask;
	/// Iteramos y reemplazamos
	QMapIterator<QString, QString> i ( m_valores );
	while ( i.hasNext() ) {
	    i.next();
	    cad.replace("["+i.key()+"]", m_valores.value(i.key()));
	}
      
      
    } // end if

    m_textBusqueda->setText ( cad );

    m_semaforo = FALSE;
    emit ( valueChanged ( mdb_id ) );
    
}
开发者ID:trifolio6,项目名称:Bulmages,代码行数:41,代码来源:blsearchwidget.cpp


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