本文整理汇总了C++中QMapIterator::hasNext方法的典型用法代码示例。如果您正苦于以下问题:C++ QMapIterator::hasNext方法的具体用法?C++ QMapIterator::hasNext怎么用?C++ QMapIterator::hasNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMapIterator
的用法示例。
在下文中一共展示了QMapIterator::hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: statusIconChanged
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;
}
}
}
示例2: documentTitleChanged
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;
}
}
}
示例3: setId
/**
\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();
}
示例4: 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;
}
示例5: cmdListUsers
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;
}
示例6: testProperties
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);
}
示例7: keyProcessing
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;
}
示例8: ChildNeedUpdate
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);
}
}
}
示例9:
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;
}
示例10: findBuildIndex
int xmlWriter::findBuildIndex(int buildID){
QMapIterator<QString, QString> mapIterator = QMapIterator<QString, QString>(buildUniqueID);
if(!mapIterator.hasNext()){
return -1;
}
QMapIterator<QString, QString> mapI(buildUniqueID);
int count = 0;
while (mapI.hasNext())
{
mapI.next();
if(!mapI.value().compare(QString::number(buildID)))
return count;
count++;
}
return -1;
}
示例11: BlWidget
/**
\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);
}
示例12: while
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));
}
}
}
示例13: setFilterAnisotropy
void Material::setFilterAnisotropy( float anisotropy )
{
if( anisotropy > filterAnisotropyMaximum() )
anisotropy = filterAnisotropyMaximum();
else if( anisotropy < 1.0f )
anisotropy = 1.0f;
QHashIterator< QString, QWeakPointer<MaterialData> > mi( Material::cache() );
while( mi.hasNext() )
{
mi.next();
QSharedPointer<MaterialData> d = mi.value().toStrongRef();
if( d.isNull() )
continue;
QMapIterator<QString,GLuint> ti (d->textures());
while( ti.hasNext() )
{
ti.next();
glBindTexture( GL_TEXTURE_2D, ti.value() );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy );
}
}
sFilterAnisotropy = anisotropy;
}
示例14: url
int Go2Car2GoEngine::request ( const Car2goMethod &method, bool get )
{
QMap<QString,QString> map = method.args;
QMapIterator<QString, QString> i ( map );
QStringList keyList;
while ( i.hasNext() )
{
i.next();
keyList << i.key();
}
qSort ( keyList.begin(), keyList.end() );
QUrl url ( GO2CAR2GO_HOST + method.method, QUrl::TolerantMode );
for ( int i = 0; i < keyList.size(); ++i )
{
url.addQueryItem ( keyList.at ( i ), map.value ( keyList.at ( i ) ) );
}
requestCounter++;
RequestData requestData;
requestData.requestId = requestCounter;
QNetworkReply *reply;
if ( get )
reply = net_manager->get ( QNetworkRequest ( url ) );
else
reply = net_manager->post ( QNetworkRequest ( QUrl(GO2CAR2GO_SECURED_HOST) ), url.encodedQuery () );
requestDataMap.insert ( reply , requestData );
qDebug() << "request id: " << url;
return requestData.requestId;
}
示例15: exec
bool MSqlQuery::exec()
{
if (!m_db)
{
// Database structure's been deleted
return false;
}
if (m_last_prepared_query.isEmpty())
{
LOG(VB_GENERAL, LOG_ERR,
"MSqlQuery::exec(void) called without a prepared query.");
return false;
}
#if DEBUG_RECONNECT
if (random() < RAND_MAX / 50)
{
LOG(VB_GENERAL, LOG_INFO,
"MSqlQuery disconnecting DB to test reconnection logic");
m_db->m_db.close();
}
#endif
// Database connection down. Try to restart it, give up if it's still
// down
if (!m_db->isOpen() && !Reconnect())
{
LOG(VB_GENERAL, LOG_INFO, "MySQL server disconnected");
return false;
}
QElapsedTimer timer;
timer.start();
bool result = QSqlQuery::exec();
qint64 elapsed = timer.elapsed();
// 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 && Reconnect())
result = QSqlQuery::exec();
if (!result)
{
QString err = MythDB::GetError("MSqlQuery", *this);
MSqlBindings tmp = QSqlQuery::boundValues();
bool has_null_strings = false;
for (MSqlBindings::iterator it = tmp.begin(); it != tmp.end(); ++it)
{
if (it->type() != QVariant::String)
continue;
if (it->isNull() || it->toString().isNull())
{
has_null_strings = true;
*it = QVariant(QString(""));
}
}
if (has_null_strings)
{
bindValues(tmp);
timer.restart();
result = QSqlQuery::exec();
elapsed = timer.elapsed();
}
if (result)
{
LOG(VB_GENERAL, LOG_ERR,
QString("Original query failed, but resend with empty "
"strings in place of NULL strings worked. ") +
"\n" + err);
}
}
if (VERBOSE_LEVEL_CHECK(VB_DATABASE, LOG_INFO))
{
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_INFO,
QString("MSqlQuery::exec(%1) %2%3%4")
.arg(m_db->MSqlDatabase::GetConnectionName()).arg(str)
.arg(QString(" <<<< Took %1ms").arg(QString::number(elapsed)))
.arg(isSelect() ? QString(", Returned %1 row(s)")
.arg(size()) : QString()));
//.........这里部分代码省略.........