/** \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(); }
qReal::IdList Repository::elementsByPropertyContent(const QString &propertyValue, bool sensitivity , bool regExpression) const { const Qt::CaseSensitivity caseSensitivity = sensitivity ? Qt::CaseSensitive : Qt::CaseInsensitive; const QRegExp regExp(propertyValue, caseSensitivity); IdList result; for (Object * const element : mObjects.values()) { QMapIterator<QString, QVariant> iterator = element->propertiesIterator(); if (regExpression) { while (iterator.hasNext()) { if (iterator.next().value().toString().contains(regExp)) { result.append(mObjects.key(element)); break; } } } else { while (iterator.hasNext()) { if (iterator.next().value().toString().contains(propertyValue, caseSensitivity)) { result.append(mObjects.key(element)); break; } } } } return result; }
void LocationTable::splitByAnchors(const QByteArray& text, const KDevelop::SimpleCursor& textStartPosition, QList<QByteArray>& strings, QList<KDevelop::SimpleCursor>& anchors) const { KDevelop::SimpleCursor currentCursor = textStartPosition; size_t currentOffset = 0; QMapIterator<std::size_t, KDevelop::SimpleCursor> it = m_offsetTable; while (currentOffset < (size_t)text.length()) { KDevelop::SimpleCursor nextCursor; size_t nextOffset; if(it.hasNext()) { it.next(); nextOffset = it.key(); nextCursor = it.value(); }else{ nextOffset = text.length(); nextCursor = KDevelop::SimpleCursor::invalid(); } if( nextOffset-currentOffset > 0 ) { strings.append(text.mid(currentOffset, nextOffset-currentOffset)); anchors.append(currentCursor); } currentOffset = nextOffset; currentCursor = nextCursor; } }
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; } }
//--------------------------------------------------------------------------- // 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)); }
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'); } } } }
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); }
void KisBaseNode::mergeNodeProperties(const KoProperties & properties) { QMapIterator<QString, QVariant> iter = properties.propertyIterator(); while (iter.hasNext()) { iter.next(); m_d->properties.setProperty(iter.key(), iter.value()); } }
void LocationTable::dump() const { QMapIterator<std::size_t, KDevelop::SimpleCursor> it = m_offsetTable; kDebug(9007) << "Location Table:"; while (it.hasNext()) { it.next(); kDebug(9007) << it.key() << " => " << it.value().textCursor(); } }
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(); } }
void DraggerManager::disableDraggers() { Q_D(DraggerManager); QMapIterator<WidgetProperties *, QDeclarativeItem *> iterator = QMapIterator<WidgetProperties *, QDeclarativeItem *>(d->draggers); while (iterator.hasNext()) { iterator.next(); iterator.value()->setVisible(false); } }
void DraggerManagerPrivate::clear() { QMapIterator<WidgetProperties *, QDeclarativeItem *> iterator = QMapIterator<WidgetProperties *, QDeclarativeItem *>(draggers); while (iterator.hasNext()) { iterator.next(); iterator.value()->deleteLater(); } draggers.clear(); }
Response::ResponseCode Server_ProtocolHandler::cmdListUsers(const Command_ListUsers & /*cmd*/, ResponseContainer &rc) { if (authState == NotLoggedIn) return Response::RespLoginNeeded; Response_ListUsers *re = new Response_ListUsers; server->clientsLock.lockForRead(); QMapIterator<QString, Server_ProtocolHandler *> userIterator = server->getUsers(); while (userIterator.hasNext()) re->add_user_list()->CopyFrom(userIterator.next().value()->copyUserInfo(false)); QMapIterator<QString, Server_AbstractUserInterface *> extIterator = server->getExternalUsers(); while (extIterator.hasNext()) re->add_user_list()->CopyFrom(extIterator.next().value()->copyUserInfo(false)); acceptsUserListChanges = true; server->clientsLock.unlock(); rc.setResponseExtension(re); return Response::RespOk; }
bool KisBaseNode::check(const KoProperties & properties) const { QMapIterator<QString, QVariant> iter = properties.propertyIterator(); while (iter.hasNext()) { iter.next(); if (m_d->properties.contains(iter.key())) { if (m_d->properties.value(iter.key()) != iter.value()) return false; } } return true; }
KisBaseNode::KisBaseNode(const KisBaseNode & rhs) : QObject() , KisShared(rhs) , m_d(new Private()) { QMapIterator<QString, QVariant> iter = rhs.m_d->properties.propertyIterator(); while (iter.hasNext()) { iter.next(); m_d->properties.setProperty(iter.key(), iter.value()); } m_d->linkedTo = rhs.m_d->linkedTo; }
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; }
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."; } } }
/** 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 ) ); }
void Container::documentTitleChanged(Sublime::Document* doc) { QMapIterator<QWidget*, View*> it = d->viewForWidget; while (it.hasNext()) { if (it.next().value()->document() == doc) { d->fileNameCorner->setText( doc->title() ); int tabIndex = d->stack->indexOf(it.key()); if (tabIndex != -1) { d->tabBar->setTabText(tabIndex, doc->title()); } break; } } }
void Container::statusIconChanged(Document* doc) { QMapIterator<QWidget*, View*> it = d->viewForWidget; while (it.hasNext()) { if (it.next().value()->document() == doc) { d->fileStatus->setPixmap( doc->statusIcon().pixmap( QSize( 16,16 ) ) ); int tabIndex = d->stack->indexOf(it.key()); if (tabIndex != -1) { d->tabBar->setTabIcon(tabIndex, doc->statusIcon()); } break; } } }
/** \param val **/ void BlSearchWidget::setId ( QString val, bool cargarvalores ) { BL_FUNC_DEBUG BlDebug::blDebug ( "BlSearchWidget::setId", 0, val ); mdb_id = val; if ( m_tabla == "" || !cargarvalores) { return; } // end if if ( val == "" ) { m_inputBusqueda->setText ( "" ); m_textBusqueda->setText ( "" ); mdb_id = ""; /// Inicializamos los valores de vuelta a "" QMapIterator<QString, QString> i ( m_valores ); while ( i.hasNext() ) { i.next(); m_valores.insert ( i.key(), "" ); } // end while } else { QString SQLQuery(""); SQLQuery = "SELECT * FROM " + m_tabla + " WHERE " + m_campoid + "= $1"; BlDbRecordSet *cur = mainCompany() ->load( SQLQuery, mdb_id ); 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 } // end if delete cur; } // end if pinta(); }
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; }
ResponseCode Server_ProtocolHandler::cmdListUsers(Command_ListUsers * /*cmd*/, CommandContainer *cont) { if (authState == PasswordWrong) return RespLoginNeeded; QList<ServerInfo_User *> resultList; QMapIterator<QString, Server_ProtocolHandler *> userIterator = server->getUsers(); while (userIterator.hasNext()) resultList.append(new ServerInfo_User(userIterator.next().value()->getUserInfo(), false)); acceptsUserListChanges = true; cont->setResponse(new Response_ListUsers(cont->getCmdId(), RespOk, resultList)); return RespNothing; }
/** * @brief reads the commands that are available form the stored settings * @param commandMap the map that is to store * @return * void */ void DLDConfigureOB::writeCommandMap (QMap<QString, QString> commandMap) { QMapIterator<QString, QString> iter (commandMap); int i; QString nameBase = "%1-commandName"; QString descBase = "%1-commandDescription"; for (i = 0; iter.hasNext (); i++) { iter.next(); settings->setValue(nameBase.arg(i), iter.key()); settings->setValue(descBase.arg(i), iter.value()); } settings->setValue("numberOfCommands", i); emit commandListChanged (); }
void KPropertiesTest::testProperties() { KProperties props; QVERIFY(props.isEmpty()); QString visible = "visible"; QVERIFY(!props.value(visible).isValid()); props.setProperty("visible", "bla"); QVERIFY(props.value("visible") == "bla"); QVERIFY(props.stringProperty("visible", "blabla") == "bla"); props.setProperty("bool", true); QVERIFY(props.boolProperty("bool", false) == true); props.setProperty("bool", false); QVERIFY(props.boolProperty("bool", true) == false); props.setProperty("qreal", 1.0); QVERIFY(props.doubleProperty("qreal", 2.0) == 1.0); props.setProperty("qreal", 2.0); QVERIFY(props.doubleProperty("qreal", 1.0) == 2.0); props.setProperty("int", 1); QVERIFY(props.intProperty("int", 2) == 1); props.setProperty("int", 2); QVERIFY(props.intProperty("int", 1) == 2); QVariant v; QVERIFY(props.property("sdsadsakldjsajd", v) == false); QVERIFY(!v.isValid()); QVERIFY(props.property("visible", v) == true); QVERIFY(v.isValid()); QVERIFY(v == "bla"); QVERIFY(!props.isEmpty()); QVERIFY(props.contains("visible")); QVERIFY(!props.contains("adsajkdsakj dsaieqwewqoie")); QVERIFY(props.contains(visible)); int count = 0; QMapIterator<QString, QVariant> iter = props.propertyIterator(); while (iter.hasNext()) { iter.next(); count++; } QVERIFY(count == 4); }
bool InformWindow::keyProcessing(const int &key) { QMapIterator<int, Command*> it (kbCommand); while (it.hasNext()) { it.next(); if (key == it.key()) { if (it.value() != NULL) { it.value()->execute(); return true; } } } return false; }
void QtPropertyDataIntrospection::ChildNeedUpdate() { QMapIterator<QtPropertyDataDavaVariant*, const DAVA::IntrospectionMember *> i = QMapIterator<QtPropertyDataDavaVariant*, const DAVA::IntrospectionMember *>(childVariantMembers); while(i.hasNext()) { i.next(); QtPropertyDataDavaVariant *childData = i.key(); DAVA::VariantType childCurValue = i.value()->Value(object); if(childCurValue != childData->GetVariantValue()) { childData->SetVariantValue(childCurValue); } } }
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; }
void ViewManager::ViewManagerPrivate::slotLockedChanged(bool locked) { if(locked) { // When the view is locked, all draggers should be destroyed QMapIterator<WidgetProperties *, QDeclarativeItem *> iterator = QMapIterator<WidgetProperties *, QDeclarativeItem *>(registeredDraggers); while (iterator.hasNext()) { iterator.next(); QDeclarativeItem *item = iterator.value(); registeredDraggers.remove(iterator.key()); item->deleteLater(); } q->setCurrentDraggedWidget(""); } else { // For each item in the current page, a dragger should // be created DisplayedPageWidgetsModel * pageModel = displayedPagesModel->pageModel(currentPageIndex); for (int i = 0; i < pageModel->rowCount(); i++) { emit q->requestCreateDragger(pageModel->widget(i)); } } }
/** \param parent **/ BlSearchWidget::BlSearchWidget ( QWidget *parent ) : BlWidget ( parent ) { BL_FUNC_DEBUG setupUi ( this ); m_textBusqueda->setText ( "" ); mdb_id = ""; m_campoid = ""; /// Inicializamos los valores de vuelta a "" QMapIterator<QString, QString> i ( m_valores ); while ( i.hasNext() ) { i.next(); m_valores.insert ( i.key(), "" ); } // end while m_semaforo = FALSE; m_mask = ""; /// Establecemos la delegacion del foco en el texto setFocusProxy(m_textBusqueda); }