本文整理汇总了C++中QStrList类的典型用法代码示例。如果您正苦于以下问题:C++ QStrList类的具体用法?C++ QStrList怎么用?C++ QStrList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QStrList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readRating
void Board::readRating(KConfig *config)
{
QStrList list;
QString tmp;
if (config->readListEntry("StoneValues", list)) {
stoneValue[0] = 0;
for(int i=1;i<6;i++)
stoneValue[i] = (tmp = list.at(i-1)).toInt();
}
if (config->readListEntry("MoveValues", list)) {
for(int i=0;i<5;i++)
moveValue[i] = (tmp = list.at(i)).toInt();
}
if (config->readListEntry("RingValues", list)) {
for(int i=0;i<5;i++)
ringValue[i] = (tmp = list.at(i)).toInt();
}
if (config->readListEntry("RingDiffs", list)) {
for(int i=0;i<5;i++)
ringDiff[i] = (tmp = list.at(i)).toInt();
}
setFieldValues();
}
示例2: readListConf
int readListConf ( KConfig *conf, QString key, QStrList &list )
{
if( !conf->hasKey( key ) )
{
// debug("readListConf:: key does not exist");
return 0;
}
QString str_list, value;
str_list = conf->readEntry(key);
if(str_list.isEmpty())
{
// debug("readListConf:: list is empty");
return 0;
}
list.clear();
int i;
int len = str_list.length();
for( i = 0; i < len; i++ )
{
if( str_list[i] != ',' && str_list[i] != '\\' )
{
value += str_list[i];
continue;
}
if( str_list[i] == '\\' )
{
i++;
value += str_list[i];
continue;
}
list.append(value);
value.truncate(0);
}
list.append(value);
}
示例3: writeListConf
void writeListConf ( KConfig *conf, QString key, QStrList &list )
{
if( list.isEmpty() )
{
conf->writeEntry(key, "");
return;
}
QString str_list;
QString value;
int i;
for( value = list.first(); value != ""; value = list.next() )
{
for( i = 0; i < (int) value.length(); i++ )
{
switch( value[i] ) {
case ',':
str_list += '\\';
break;
case '\\':
str_list += '\\';
break;
//defaults:
//;
};
str_list += value[i];
}
str_list += ',';
}
if( str_list.right(1) == "," )
str_list.truncate(str_list.length()-1);
conf->writeEntry(key, str_list);
}
示例4: addPath
KIconLoader::KIconLoader( KConfig *conf,
const QString &app_name, const QString &var_name ){
QStrList list;
config = conf;
config->setGroup(app_name);
config->readListEntry( var_name, list, ':' );
for (const char *it=list.first(); it; it = list.next())
addPath(it);
initPath();
name_list.setAutoDelete(TRUE);
pixmap_dirs.setAutoDelete(TRUE);
pixmap_list.setAutoDelete(TRUE);
/*
for(char* c = pixmap_dirs.first(); c ; c = pixmap_dirs.next()){
printf("in path:%s\n",pixmap_dirs.current());
}
*/
}
示例5: slotMove
void KFMClient::slotMove( const char *_src_urls, const char *_dest_url )
{
QString s = _src_urls;
s.detach();
QStrList urlList;
QString dest = _dest_url;
if ( dest == "trash:/" )
dest = "file:" + KFMPaths::TrashPath();
int i;
while ( ( i = s.find( "\n" ) ) != -1 )
{
QString t = s.left( i );
urlList.append( t.data() );
s = s.mid( i + 1, s.length() );
}
urlList.append( s.data() );
KIOJob *job = new KIOJob();
connect( job, SIGNAL( finished( int ) ), this, SLOT( finished( int ) ) );
if ( urlList.count() == 1 )
job->move( urlList.first(), dest.data() );
else
job->move( urlList, dest.data() );
}
示例6: slotCopyClients
void KFMServer::slotCopyClients( const char *_src_urls, const char *_dest_url )
{
QString s = _src_urls;
s.detach();
QStrList urlList;
QString dest = _dest_url;
if ( dest == "trash:/" )
dest = "file:" + KFMPaths::TrashPath();
int i;
while ( ( i = s.find( "\n" ) ) != -1 )
{
QString t = s.left( i );
urlList.append( t.data() );
s = s.mid( i + 1, s.length() );
}
urlList.append( s.data() );
KIOJob *job = new KIOJob();
if ( urlList.count() == 1 )
job->copy( urlList.first(), dest.data() );
else
job->copy( urlList, dest.data() );
}
示例7: l
/*!
Decodes URLs from \a e, placing the result in \a l (which is first cleared).
Returns TRUE if the event contained a valid list of URLs.
*/
bool QUrlDrag::decode( QDropEvent* e, QStrList& l )
{
QByteArray payload = e->data( "url/url" );
if ( payload.size() ) {
e->accept();
l.clear();
l.setAutoDelete(TRUE);
uint c=0;
char* d = payload.data();
while (c < payload.size()) {
uint f = c;
while (c < payload.size() && d[c])
c++;
if ( c < payload.size() ) {
l.append( d+f );
c++;
} else {
QString s(d+f,c-f+1);
l.append( s );
}
}
return TRUE;
}
return FALSE;
}
示例8: l
/*!
Decodes URIs from \a e, placing the result in \a l (which is first cleared).
Returns TRUE if the event contained a valid list of URIs.
*/
bool QUriDrag::decode( const QMimeSource* e, QStrList& l )
{
QByteArray payload = e->encodedData( "text/uri-list" );
if ( payload.size() ) {
l.clear();
l.setAutoDelete(TRUE);
uint c=0;
char* d = payload.data();
while (c < payload.size() && d[c]) {
uint f = c;
// Find line end
while (c < payload.size() && d[c] && d[c]!='\r'
&& d[c] != '\n')
c++;
QCString s(d+f,c-f+1);
if ( s[0] != '#' ) // non-comment?
l.append( s );
// Skip junk
while (c < payload.size() && d[c] &&
(d[c]=='\n' || d[c]=='\r'))
c++;
}
return TRUE;
}
return FALSE;
}
示例9: setGeometry
ac::ac(const QString &changes, QWidget *parent, const char *name, const QStringList &)
:AcDialog(parent, name)
{
borderFrame->hide();
setGeometry( x(), y(), 500, 30);
borderFrame->setGeometry( 0, 0, 500, 400);
konsoleFrame->setGeometry( 0, 0, 500, 400);
appdir = "/usr/share/apt-get-konsole/";
loadKonsole();
konsoleFrame->installEventFilter( this );
changes2 = changes;
QStrList run;
run.append( appdir+"sh/applyChanges" );
run.append( changes );
// run command
terminal()->startProgram( appdir+"sh/applyChanges", run );
j=0;
firstdownload = TRUE;
connect( konsole, SIGNAL( receivedData( const QString& ) ), SLOT( shellOutput( const QString&) ) );
connect( konsole, SIGNAL( destroyed() ), SLOT( close() ) );
}
示例10: buildDatumMenu
void ossimQtQuadProjectionController::buildDatumMenu() const
{
// Build the datum menu.
QStrList datumList;
std::vector<ossimString> tempOssimDatumList =
ossimDatumFactory::instance()->getList();
std::vector<ossimString>::iterator listIter = tempOssimDatumList.begin();
while(listIter != tempOssimDatumList.end())
{
const ossimDatum* datum = ossimDatumFactory::instance()->
create(*listIter);
if(datum)
{
datumList.append((datum->code() + ": " + datum->name()).c_str());
}
++listIter;
}
theDialog->theDatumComboBox->clear();
theDialog->theDatumComboBox->insertStrList(datumList);
// Set to WGE for default (WGS-84).
const int COUNT = theDialog->theDatumComboBox->count();
for (int i = 0; i < COUNT; ++i)
{
ossimString name = theDialog->theDatumComboBox->text(i).ascii();
if (name.contains("WGE"))
{
theDialog->theDatumComboBox->setCurrentItem(i);
break;
}
}
}
示例11: kdDebug
void RubySupportPart::projectOpened()
{
kdDebug() << "projectOpened()" << endl;
QStrList l;
l.append( shell().latin1() ) ;
m_shellWidget->setShell( shell().latin1(), l );
m_shellWidget->activate();
m_shellWidget->setAutoReactivateOnClose( true );
connect( project(), SIGNAL(addedFilesToProject(const QStringList &)),
this, SLOT(addedFilesToProject(const QStringList &)) );
connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)),
this, SLOT(removedFilesFromProject(const QStringList &)) );
QFileInfo program(mainProgram());
// If it's a Rails project, create the project files if they're missing
if (mainProgram().endsWith("script/server")) {
QString cmd;
QFileInfo server(project()->projectDirectory() + "/script/server");
if (! server.exists()) {
cmd += "rails " + project()->projectDirectory();
if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
appFrontend->startAppCommand(project()->projectDirectory(), cmd, false);
}
}
// We want to parse only after all components have been
// properly initialized
QTimer::singleShot(0, this, SLOT(initialParse()));
}
示例12: saveGroup
void
KAMenu::slotHostlistChanged()
{
/* die Liste der erreichbaren Archiehosts hat sich
* veraendert. neu einlesen
*/
// KConfig *config = KApplication::getKApplication()->getConfig();
QStrList archiehostlist;
// int archiehostlistnumber =
KConfigGroupSaver saveGroup( config, "HostConfig" );
config->readListEntry( "Hosts", archiehostlist );
// QString currenthost = config->readEntry( "CurrentHost", "archie.sura.net" );
QString defaulthost = "archie.sura.net" ;
if ( archiehostlist.isEmpty() ) {
archiehostlist.append( defaulthost );
// currentHostId = 0;
}
host->clear();
char *tmpStr;
int i = 0;
for (tmpStr=archiehostlist.first(); tmpStr; tmpStr=archiehostlist.next()) {
host->insertItem( tmpStr, i, i);
i++;
}
slotConfigChanged();
emit sigArchieHost(host->text(host_id));
}
示例13: allObjects
QStrList objFinder::allObjects(){ /*fold00*/
QStrList allNames;
QDictIterator<QObject> it(*objList);
while(it.current()){
QObjectList *qobl = it.current()->queryList(); // Matches everything
QObjectListIt itql( *qobl );
while(itql.current()){
QString name;
name = itql.current()->className();
name += "::";
name += itql.current()->name("unnamed");
allNames.append(name);
++itql;
}
delete qobl;
++it;
}
QWidgetList *all = QApplication::allWidgets();
QWidgetListIt itW(*all);
while(itW.current()){
QString name;
name = itW.current()->className();
name += "::";
name += itW.current()->name("unnamed");
allNames.append(name);
++itW;
}
delete all;
return allNames;
}
示例14: getData
void CDDBSetup::getData(QStrList& _serverlist,
QStrList& _submitlist,
QString& _basedir,
QString& _submitaddress,
QString& _current_server,
bool& remote_enabled,
bool& http_proxy_enabled,
QString &http_proxy_host,
int &http_proxy_port)
{
uint i;
_serverlist.clear();
_submitlist.clear();
for(i = 0; i < server_listbox->count();i++){
_serverlist.append(server_listbox->text(i));
}
for(i = 0; i < submission_listbox->count(); i++){
_submitlist.append(submission_listbox->text(i));
}
_basedir = basedirstring.copy();
_submitaddress = submitaddressstring.copy();
_current_server = current_server_string.copy();
remote_enabled = remote_cddb_cb->isChecked();
http_proxy_enabled = cddb_http_cb->isChecked();
http_proxy_host = proxy_host_ef->text();
http_proxy_port = atoi(proxy_port_ef->text());
}
示例15: QObject
KIconTemplateContainer::KIconTemplateContainer() : QObject()
{
QString path;
instances++;
debug("KIconTemplateContainer: instances %d", instances);
if(templatelist)
return;
debug("KIconTemplateContainer: Creating templates");
templatelist = new QList<KIconTemplate>;
templatelist->setAutoDelete(true);
QStrList names;
KConfig *k = kapp->getConfig();
k->setGroup("Templates");
k->readListEntry("Names", names);
for(int i = 0; i < (int)names.count(); i++)
{
KIconTemplate *it = new KIconTemplate;
it->path = k->readEntry(names.at(i));
it->title = names.at(i);
//debug("Template: %s\n%s", names.at(i), path.data());
templatelist->append(it);
}
if(templatelist->count() == 0)
{
createStandardTemplates(templatelist);
}
}