本文整理汇总了C++中QStrList::find方法的典型用法代码示例。如果您正苦于以下问题:C++ QStrList::find方法的具体用法?C++ QStrList::find怎么用?C++ QStrList::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStrList
的用法示例。
在下文中一共展示了QStrList::find方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clearAlignList
static void clearAlignList( QStrList &l )
{
if ( l.count() == 1 )
return;
if ( l.find( "AlignAuto" ) != -1 )
l.remove( "AlignAuto" );
if ( l.find( "WordBreak" ) != -1 )
l.remove( "WordBreak" );
}
示例2: doConnections
void MetaDataBase::doConnections( QObject *o )
{
setupDataBase();
MetaDataBaseRecord *r = db->find( (void*)o );
if ( !r ) {
qWarning( "No entry for %p (%s, %s) found in MetaDataBase",
o, o->name(), o->className() );
return;
}
QObject *sender = 0, *receiver = 0;
QObjectList *l = 0;
QValueList<Connection>::Iterator it = r->connections.begin();
for ( ; it != r->connections.end(); ++it ) {
Connection conn = *it;
if ( qstrcmp( conn.sender->name(), o->name() ) == 0 ) {
sender = o;
} else {
l = o->queryList( 0, conn.sender->name(), false );
if ( !l || !l->first() ) {
delete l;
continue;
}
sender = l->first();
delete l;
}
if ( qstrcmp( conn.receiver->name(), o->name() ) == 0 ) {
receiver = o;
} else {
l = o->queryList( 0, conn.receiver->name(), false );
if ( !l || !l->first() ) {
delete l;
continue;
}
receiver = l->first();
delete l;
}
QString s = "2""%1";
s = s.arg( conn.signal );
QString s2 = "1""%1";
s2 = s2.arg( conn.slot );
QStrList signalList = sender->metaObject()->signalNames( true );
QStrList slotList = receiver->metaObject()->slotNames( true );
// avoid warnings
if ( signalList.find( conn.signal ) == -1 ||
slotList.find( conn.slot ) == -1 )
continue;
QObject::connect( sender, s, receiver, s2 );
}
}
示例3: save
void QSPixmapClass::save( QSEnv *env )
{
if ( env->numArgs() < 1 || env->numArgs() > 2 ) {
env->throwError( QString::fromLatin1( "Pixmap.save() called with %1 arguments. 1 or 2 argument expected." ).
arg( env->numArgs() ) );
return;
}
QSObject t = env->thisValue();
QSPixmapClass *pac = (QSPixmapClass*)t.objectType();
QPixmap *pix = pac->pixmap( &t );
if ( !env->arg( 0 ).isString() ) {
env->throwError( QString::fromLatin1( "Pixmap.save() called with an argument of type %1. "
"Type String is expeced" ).
arg( env->arg( 0 ).typeName() ) );
return;
}
QString format = QFileInfo( env->arg( 0 ).toString() ).extension().upper();
QStrList l = QImageIO::outputFormats();
if ( l.find( format.latin1() ) == -1 )
format = QString::fromLatin1("PNG");
if ( env->numArgs() == 2 ) {
if ( !env->arg( 1 ).isString() ) {
env->throwError( QString::fromLatin1( "Pixmap.save() called with an argument of type %1. "
"as second argument. Type String is expeced" ).
arg( env->arg( 1 ).typeName() ) );
return;
}
format = env->arg( 1 ).toString();
}
pix->save( env->arg( 0 ).toString(), format.latin1() );
}
示例4: hasSlot
bool MetaDataBase::hasSlot( QObject *o, const QCString &slot, bool onlyCustom )
{
setupDataBase();
MetaDataBaseRecord *r = db->find( (void*)o );
if ( !r ) {
qWarning( "No entry for %p (%s, %s) found in MetaDataBase",
o, o->name(), o->className() );
return false;
}
if ( !onlyCustom ) {
QStrList slotList = o->metaObject()->slotNames( true );
if ( slotList.find( slot ) != -1 )
return true;
if ( o->inherits( "FormWindow" ) ) {
o = ( (FormWindow*)o )->mainContainer();
slotList = o->metaObject()->slotNames( true );
if ( slotList.find( slot ) != -1 )
return true;
}
if ( o->inherits( "CustomWidget" ) ) {
MetaDataBase::CustomWidget *w = ( (::CustomWidget*)o )->customWidget();
for ( QValueList<Slot>::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) {
QCString s = (*it).slot;
if ( !s.data() )
continue;
if ( s == slot )
return true;
}
}
}
for ( QValueList<Slot>::Iterator it = r->slotList.begin(); it != r->slotList.end(); ++it ) {
Slot s = *it;
if ( normalizeSlot( s.slot ) == normalizeSlot( slot ) )
return true;
}
return false;
}
示例5:
bool MetaDataBase::CustomWidget::hasSignal( const QCString &signal ) const
{
QStrList sigList = QWidget::staticMetaObject()->signalNames( true );
if ( sigList.find( signal ) != -1 )
return true;
for ( QValueList<QCString>::ConstIterator it = lstSignals.begin(); it != lstSignals.end(); ++it ) {
if ( normalizeSlot( *it ) == normalizeSlot( signal ) )
return true;
}
return false;
}
示例6: WriteConfig
bool KHost::WriteConfig()
{
KConfig *config = ((KConnection*) topLevelWidget())->GetConfig();
QStrList List;
const char *Value;
int i;
if (config == NULL)
return FALSE;
hostChanged(0);
portChanged(0);
config->setGroup(KI_SEC_HOSTS);
if ((Value = hostCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
List.append(Value);
for (i = 0; i < hostCombo->count(); i++)
if (List.find(hostCombo->text(i)) == -1)
List.append(hostCombo->text(i));
config->writeEntry(KI_ENT_HOSTS,List);
List.clear();
if ((Value = portCombo->currentText()) != NULL && *Value != '\0' && List.find(Value) == -1)
List.append(Value);
for (i = 0; i < portCombo->count(); i++)
if (List.find(portCombo->text(i)) == -1)
List.append(portCombo->text(i));
config->writeEntry(KI_ENT_PORTS,List);
config->writeEntry(KI_ENT_LAST_HOST,hostCombo->currentText());
config->writeEntry(KI_ENT_LAST_PORT,portCombo->currentText());
return TRUE;
}
示例7: okClicked
void EditFunctions::okClicked()
{
QValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( formWindow );
QString n = tr( "Add/Remove functions of '%1'" ).arg( formWindow->name() );
QPtrList<Command> commands;
QValueList<MetaDataBase::Function>::Iterator fit;
if ( !functionList.isEmpty() ) {
for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) {
bool functionFound = FALSE;
QValueList<FunctItem>::Iterator it = functList.begin();
for ( ; it != functList.end(); ++it ) {
if ( MetaDataBase::normalizeFunction( (*it).oldName ) ==
MetaDataBase::normalizeFunction( (*fit).function ) ) {
functionFound = TRUE;
break;
}
}
if ( !functionFound )
commands.append( new RemoveFunctionCommand( tr( "Remove function" ),
formWindow, (*fit).function, (*fit).specifier,
(*fit).access,
(*fit).type,
formWindow->project()->language(),
(*fit).returnType ) );
}
}
bool invalidFunctions = FALSE;
QValueList<FunctItem> invalidItems;
if ( !functList.isEmpty() ) {
QStrList lst;
QValueList<FunctItem>::Iterator it = functList.begin();
for ( ; it != functList.end(); ++it ) {
MetaDataBase::Function function;
function.function = (*it).newName;
function.returnType = (*it).retTyp;
function.specifier = (*it).spec;
function.access = (*it).access;
function.type = (*it).type;
function.language = formWindow->project()->language();
if ( function.returnType.isEmpty() )
function.returnType = "void";
QString s = function.function;
s = s.simplifyWhiteSpace();
bool startNum = s[ 0 ] >= '0' && s[ 0 ] <= '9';
bool noParens = s.contains( '(' ) != 1 || s.contains( ')' ) != 1;
bool illegalSpace = s.find( ' ' ) != -1 && s.find( ' ' ) < s.find( '(' );
if ( startNum || noParens || illegalSpace || lst.find( function.function ) != -1 ) {
invalidFunctions = TRUE;
invalidItems.append( (*it) );
continue;
}
bool functionFound = FALSE;
for ( fit = functionList.begin(); fit != functionList.end(); ++fit ) {
if ( MetaDataBase::normalizeFunction( (*fit).function ) ==
MetaDataBase::normalizeFunction( (*it).oldName ) ) {
functionFound = TRUE;
break;
}
}
if ( !functionFound )
commands.append( new AddFunctionCommand( tr( "Add function" ),
formWindow, function.function, function.specifier,
function.access,
function.type, formWindow->project()->language(),
function.returnType ) );
if ( MetaDataBase::normalizeFunction( (*it).newName ) != MetaDataBase::normalizeFunction( (*it).oldName ) ||
(*it).spec != (*it).oldSpec || (*it).access != (*it).oldAccess || (*it).type != (*it).oldType ||
(*it).retTyp != (*it).oldRetTyp ) {
QString normalizedOldName = MetaDataBase::normalizeFunction( (*it).oldName );
if ((*it).oldName.endsWith("const")) // make sure we get the 'const' when we remove the old name
normalizedOldName += " const";
commands.append( new ChangeFunctionAttribCommand( tr( "Change function attributes" ),
formWindow, function, normalizedOldName,
(*it).oldSpec, (*it).oldAccess, (*it).oldType,
formWindow->project()->language(), (*it).oldRetTyp ) );
}
lst.append( function.function );
}
}
if ( invalidFunctions ) {
if ( QMessageBox::information( this, tr( "Edit Functions" ),
tr( "Some syntactically incorrect functions have been defined.\n"
"Remove these functions?" ), tr( "&Yes" ), tr( "&No" ) ) == 0 ) {
QValueList<FunctItem>::Iterator it = functList.begin();
while ( it != functList.end() ) {
bool found = FALSE;
QValueList<FunctItem>::Iterator vit = invalidItems.begin();
for ( ; vit != invalidItems.end(); ++vit ) {
if ( (*vit).newName == (*it).newName ) {
invalidItems.remove( vit );
found = TRUE;
break;
}
}
if ( found ) {
int delId = (*it).id;
//.........这里部分代码省略.........