本文整理汇总了C++中qstringlist::Iterator类的典型用法代码示例。如果您正苦于以下问题:C++ Iterator类的具体用法?C++ Iterator怎么用?C++ Iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preprocessMessage
void KviWindow::preprocessMessage(QString & szMessage)
{
// FIXME: slow
if(!m_pConsole)
return;
if(!m_pConsole->connection())
return;
static QString szNonStandardLinkPrefix = QString::fromAscii("\r![");
if(szMessage.contains(szNonStandardLinkPrefix))
return; // contains a non standard link that may contain spaces, do not break it.
// FIXME: This STILL breaks $fmtlink() in certain configurations
QStringList strings = szMessage.split(" ");
for(QStringList::Iterator it = strings.begin(); it != strings.end(); ++it )
{
if(it->contains('\r'))
continue;
QString szTmp(*it);
szTmp = KviControlCodes::stripControlBytes(szTmp).trimmed();
if(szTmp.length() < 1)
continue;
if(m_pConsole->connection()->serverInfo()->supportedChannelTypes().contains(szTmp[0]))
{
if((*it) == szTmp)
*it = QString("\r!c\r%1\r").arg(*it);
else
*it = QString("\r!c%1\r%2\r").arg(szTmp,*it);
}
}
szMessage = strings.join(" ");
}
示例2: loadProfiles
void QIMPenInput::loadProfiles()
{
profileList.clear();
profile = 0;
delete shortcutCharSet;
shortcutCharSet = new QIMPenCharSet();
shortcutCharSet->setTitle( tr("Shortcut") );
QString path = QPEApplication::qpeDir() + "etc/qimpen";
QDir dir( path, "*.conf" );
QStringList list = dir.entryList();
QStringList::Iterator it;
for ( it = list.begin(); it != list.end(); ++it ) {
QIMPenProfile *p = new QIMPenProfile( path + "/" + *it );
profileList.append( p );
if ( p->shortcut() ) {
QIMPenCharIterator it( p->shortcut()->characters() );
for ( ; it.current(); ++it ) {
shortcutCharSet->addChar( new QIMPenChar(*it.current()) );
}
}
}
Config config( "handwriting" );
config.setGroup( "Settings" );
QString prof = config.readEntry( "Profile", "Default" );
selectProfile( prof );
}
示例3: restart
void Process::restart()
{
bool changed = false;
if (mPath.compare(getTaskDefinition().getFirst()) != 0)
changed = true;
if (getTaskDefinition().getSecondList().size() != mArguments.size())
changed = true;
if (!changed)
{
int index = 0;
for (QStringList::Iterator it = mArguments.begin(); it != mArguments.end(); it++)
{
if (it->compare(getTaskDefinition().getSecondList().at(index)) != 0)
{
changed = true;
break;
}
index++;
}
}
if (changed)
{
LOG_WARNING() << "Task definition for the process " << getTaskDefinition().getName() << " changed since the last execution. Restarting with the previous "
<< "path and arguments. To use the new Values, stop and run the Simulation.";
}
restartProcess();
}
示例4: collectStyles
SvgStyles SvgStyleParser::collectStyles(const KoXmlElement &e)
{
SvgStyles styleMap;
// collect individual presentation style attributes which have the priority 0
foreach(const QString &command, d->styleAttributes) {
const QString attribute = e.attribute(command);
if (!attribute.isEmpty())
styleMap[command] = attribute;
}
foreach(const QString & command, d->fontAttributes) {
const QString attribute = e.attribute(command);
if (!attribute.isEmpty())
styleMap[command] = attribute;
}
// match css style rules to element
QStringList cssStyles = d->context.matchingStyles(e);
// collect all css style attributes
foreach(const QString &style, cssStyles) {
QStringList substyles = style.split(';', QString::SkipEmptyParts);
if (!substyles.count())
continue;
for (QStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it) {
QStringList substyle = it->split(':');
if (substyle.count() != 2)
continue;
QString command = substyle[0].trimmed();
QString params = substyle[1].trimmed();
// only use style and font attributes
if (d->styleAttributes.contains(command) || d->fontAttributes.contains(command))
styleMap[command] = params;
}
}
示例5: tr
void Qt5Files::buttonClicked() {
QString filter;
if (!m_extensions.size()) {
filter = tr("All Files (*.*)");
} else {
filter = tr("Valid Files (");
for (unsigned int i=0; i<m_extensions.size(); ++i) {
if (i) filter += " ";
filter += "*."+QString::fromStdString(m_extensions[i]);
}
filter += tr(")");
}
QStringList files = QFileDialog::getOpenFileNames(nullptr, "Open Files...", filter, tr("All Files (*.*)"), nullptr, 0);
QStringList::Iterator it = files.begin();
m_value.clear();
QString text;
while (it != files.end()) {
m_value.push_back(fs::path(it->toStdString()));
if (it != files.begin()) text += ", ";
text += *it;
++it;
}
m_lineEdit->setText(text);
notify(m_value);
}
示例6: parse
void CPU::parse(QByteArray input)
{
qDebug() << "opCodes:" << opCodes;
QString in = input;
QStringList string;
if(input.isEmpty()) return;
//throw Exception("Файл пуст!");
string = in.split('\n'); // делим построчно файл
for(QStringList::Iterator i = string.begin(); i < string.end(); i++)
this->parseCommand(i->split(" ", QString::SkipEmptyParts)); // парсим каждую строку поотдельности
qDebug() << data;
}
示例7: parseColorStops
void SvgStyleParser::parseColorStops(QGradient *gradient, const KoXmlElement &e)
{
QGradientStops stops;
QColor c;
for (KoXmlNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) {
KoXmlElement stop = n.toElement();
if (stop.tagName() == "stop") {
float offset;
QString temp = stop.attribute("offset");
if (temp.contains('%')) {
temp = temp.left(temp.length() - 1);
offset = temp.toFloat() / 100.0;
} else
offset = temp.toFloat();
QString stopColorStr = stop.attribute("stop-color");
if (!stopColorStr.isEmpty()) {
if (stopColorStr == "inherit") {
stopColorStr = inheritedAttribute("stop-color", stop);
}
parseColor(c, stopColorStr);
}
else {
// try style attr
QString style = stop.attribute("style").simplified();
QStringList substyles = style.split(';', QString::SkipEmptyParts);
for (QStringList::Iterator it = substyles.begin(); it != substyles.end(); ++it) {
QStringList substyle = it->split(':');
QString command = substyle[0].trimmed();
QString params = substyle[1].trimmed();
if (command == "stop-color")
parseColor(c, params);
if (command == "stop-opacity")
c.setAlphaF(params.toDouble());
}
}
QString opacityStr = stop.attribute("stop-opacity");
if (!opacityStr.isEmpty()) {
if (opacityStr == "inherit") {
opacityStr = inheritedAttribute("stop-opacity", stop);
}
c.setAlphaF(opacityStr.toDouble());
}
stops.append(QPair<qreal, QColor>(offset, c));
}
}
if (stops.count())
gradient->setStops(stops);
}
示例8: LoadImages
void MainWindow::LoadImages() {
images_.clear();
QStringList files = QFileDialog::getOpenFileNames(
this, tr("Load Images"), "~/Pictures",
tr("Images (*.png, *.jpeg, *.jpg, *.tiff, *.bmp, *"));
QStringList files_copy = files;
for (QStringList::Iterator i = files_copy.begin(); i != files_copy.end(); ++i) {
// Load files and add to ThumbnailView.
QImage* img = new QImage(*i);
std::cout << i->toStdString() << " " << img->width() << " " << img->height() << "\n";
images_.push_back(shared_ptr<QImage>(img));
thumb_->addImage(img, *i);
}
}
示例9: setCurrentList
void KFFWin_Flightplan::setCurrentList( QStringList & list )
{
QTreeWidgetItem* item = 0;
QStringList::Iterator it;
int i = 0, j;
ui_widget.treewidget_navaids->clear();
for ( it = list.begin() ; it != list.end() ; ( it++, i++ ) )
{
item = new QTreeWidgetItem( ui_widget.treewidget_navaids );
for ( j = 0 ; j < ui_widget.treewidget_navaids->columnCount() ; j++ )
{
item->setText( j, it->section( "|", j, j ) );
}
ui_widget.treewidget_navaids->insertTopLevelItem( i, item );
}
}
示例10: ParseMasks
// -----------------------------------------------------------------------
bool ParseMasks(const char *Masks_, QSet<QString> &Patterns_, TExcludePatterns &ExcludePatterns_)
{
QStringList MasksList = QString::fromLocal8Bit(Masks_).split(';', QString::SkipEmptyParts);
for(QStringList::Iterator it = MasksList.begin(); it != MasksList.end(); ++it) {
*it = it->trimmed();
if(it->isEmpty()) return false;
}
//
for(QStringList::Iterator it = MasksList.begin(); it != MasksList.end(); ++it) {
if(Patterns_.contains(*it)) continue;
//
ExcludePatterns_.push_back(QRegExp(*it,
#ifdef Q_OS_WIN
Qt::CaseInsensitive, QRegExp::Wildcard));
#else
Qt::CaseSensitive, QRegExp::WildcardUnix));
#endif
Patterns_.insert(*it);
}
return true;
}
示例11: getImage
/**
* Funtion returns image pointer to Image located
* in cache folder where shoul be downloaded cover
* with name from parameter.
* @param name
* @return
*/
QImage* CoverDownloader::getImage(QString name) {
QDir d = QDir::current();
std::cout << "Current dir cover.. " << d.absolutePath().toStdString() << std::endl;
if (d.cd("cache")) {
QImage * img = new QImage();
QStringList filters;
filters << name + ".*";
QStringList files = d.entryList(filters, QDir::Readable | QDir::Files | QDir::NoSymLinks);
for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) {
std::cout << it->toStdString() << std::endl;
if (img->load("cache/" + *it)) {
break;
}
}
if (!img->isNull()) {
return img;
}
SAFE_DELETE(img);
}
return NULL;
}
示例12: regExpSpTab
QVector< QVector<int> > NormFilterDialog::getMatrixFromLineEdit(QTextEdit *edit) const
{ // 文字列から行列を得る
QVector< QVector<int> > result;
QTextCursor cr = edit->textCursor();
cr.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor);
for (QTextBlock block = cr.block(); block.isValid(); block = block.next()) { // 行の走査
const QString line = block.text();
const QRegExp regExpSpTab(tr("[ \\t]+"));
QStringList tokens = line.split(regExpSpTab); // スペースでトークン分割
if (!tokens.isEmpty() && tokens.first().isEmpty()) { tokens.removeFirst(); }
if (!tokens.isEmpty() && tokens.last().isEmpty()) { tokens.removeLast(); }
if (tokens.isEmpty()) { continue; }
const QRegExp regExpInt(tr("^-?\\d+$"));
QVector<int> row;
for (QStringList::Iterator it = tokens.begin(); it != tokens.end(); ++it) {
if (!regExpInt.exactMatch(*it)) { result.clear(); return result; }
row.append(it->toInt());
}
result.append(row);
}
return result;
}
示例13: open
void ReduxWidget::open() {
QStringList files = QFileDialog::getOpenFileNames( this, tr( "Open File" ), "", tr( "Log Files (*_lg*)" ) );
int sz = PATH_MAX + 1; // N.B. It is possible to construct a path longer than PATH_MAX on most systems,
// so this is really not fool-proof...
char* buf = new char[sz];
QStringList::Iterator it = files.begin();
while( it != files.end() ) {
memset( buf, 0, sz * sizeof( char ) );
if( ( ! it->isEmpty() ) && realpath( it->toStdString().c_str(), buf ) ) {
dumpMsg( QString( "Opening LogFile : " ) + *it );
/*LogFile* tmpLog = new LogFile ( buf );
bool skip = false;
for ( unsigned int i=0; i<myLogs.size(); ++i)
if ( !(*(myLogs[i]) != *tmpLog) )
skip = true;
cout << *tmpLog << endl;
if ( ! skip ) myLogs.push_back( tmpLog );
else delete tmpLog;
//myLog.load();
*/
}
++it;
}
delete[] buf;
//emit setsChanged();
//logTree->reset();
//emit jobsChanged();
//jobTree->reset();
//for (int i=0; i<myJobs.size(); ++i) cout << *myJobs[i];
//cout << myNet;
//cout << dumpXML(true) << endl;
}
示例14: parse
bool QOptions::parse(int argc, const char *const*argv)
{
if (mOptionGroupMap.isEmpty())
return false;
if (argc==1)
return true;
bool result = true;
QStringList args;
for (int i=1;i<argc;++i) {
args.append(QString::fromLocal8Bit(argv[i]));
}
QStringList::Iterator it = args.begin();
QList<QOption>::Iterator it_list;
mOptions = mOptionGroupMap.keys();
while (it != args.end()) {
if (it->startsWith("--")) {
int e = it->indexOf('=');
for (it_list = mOptions.begin(); it_list != mOptions.end(); ++it_list) {
if (it_list->longName() == it->mid(2,e-2)) {
if (it_list->type()==QOption::NoToken) {
it_list->setValue(true);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
it = args.erase(it);
break;
}
if (e>0) { //
it_list->setValue(it->mid(e+1));
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
} else {
it = args.erase(it);
if (it == args.end())
break;
it_list->setValue(*it);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
}
it = args.erase(it);
break;
}
}
if (it_list == mOptions.end()) {
qWarning() << "unknow option: " << *it;
result = false;
++it;
}
//handle unknow option
} else if (it->startsWith('-')) {
for (it_list = mOptions.begin(); it_list != mOptions.end(); ++it_list) {
QString sname = it_list->shortName();
int sname_len = sname.length(); //usally is 1
//TODO: startsWith(-height,-h) Not endsWith, -oabco
if (it->midRef(1).compare(sname) == 0) {
if (it_list->type() == QOption::NoToken) {
it_list->setValue(true);
it = args.erase(it);
break;
}
if (it->length() == sname_len+1) {//-o abco
it = args.erase(it);
if (it == args.end())
break;
it_list->setValue(*it);
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
} else {
it_list->setValue(it->mid(sname_len+1));
//qDebug("%d %s", __LINE__, qPrintable(it_list->value().toString()));
}
it = args.erase(it);
break;
}
}
if (it_list==mOptions.end()) {
qWarning() << "unknow option: " << *it;
result = false;
++it;
}
//handle unknow option
} else {
qWarning() << "unknow option: " << *it;
++it;
}
}
if (!result) {
print();
}
return result;
}
示例15: searchData
void KFFOpt_scenery::searchData( QFile* file )
{
QDomDocument doc;
QDomElement root;
QDomNode parent;
QDomNode child;
QDomElement e_parent;
QDomElement e_child;
KFFScenarioData scenario;
QString name;
QStringList list;
QStringList::Iterator it;
if ( doc.setContent( file ) )
{
root = doc.documentElement();
parent = root.firstChild();
e_parent = parent.toElement();
if ( !e_parent.isNull() )
{
if ( e_parent.tagName() == "description" )
{
list = e_parent.text().split("\n");
for (it = list.begin() ; it != list.end() ; it++ )
{
*it = it->simplified();
}
scenario.description = list.join("\n");
parent = parent.nextSibling();
}
}
parent = parent.firstChild();
name = file->fileName().section( '/', -1, -1 ).remove( ".xml" );
while ( !parent.isNull() )
{
e_parent = parent.toElement();
if ( !e_parent.isNull() )
{
if ( e_parent.tagName() == "entry" )
{
child = parent.firstChild();
while ( !child.isNull() )
{
e_child = child.toElement();
if ( !e_child.isNull() )
{
if ( e_child.tagName() == "type" )
{
scenario.type = e_child.text();
}
}
child = child.nextSibling();
}
}
if ( e_parent.tagName() == "description" )
{
list = e_parent.text().split("\n");
for (it = list.begin() ; it != list.end() ; it++ )
{
*it = it->simplified();
}
scenario.description = list.join("\n");
}
}
parent = parent.nextSibling();
}
if ( !m_scenarii.contains( name ) )
{
m_scenarii[name] = scenario;
}
}
else
{
qDebug() << file->fileName() << "is not a valide xml file" ;
}
}