本文整理汇总了C++中qstringlist::const_iterator::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::toInt方法的具体用法?C++ const_iterator::toInt怎么用?C++ const_iterator::toInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::toInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseString
void Chatbox::parseString(QString str) {
if (str[0] != '!') {
emit message(str);
return;
}
str[0] = ' ';
str = str.trimmed().toLower();
QStringList list = str.split(QRegExp("\\s+"));
QStringList::const_iterator it = list.begin();
if (it->contains(rgxPos)) {
emit playStone(Position(*it));
} else if (*it == "pass" || *it == "p") {
emit pass();
} else if (*it == "undo" || *it == "u") {
emit undo();
} else if (*it == "kill" || *it == "k") {
if (++it == list.end() || !it->contains(rgxPos))
display("Expected position as second argument.");
else
emit kill(Position(*it));
} else if (*it == "exit" || *it == "e") {
emit exit();
} else if (*it == "connect" || *it == "c") {
if (++it != list.end()) {
emit setHost(*it);
if (++it != list.end()) {
emit setPort(it->toInt());
}
}
emit cl_connect();
} else if (*it == "disconnect" || *it == "dc") {
emit cl_disconnect();
} else if (*it == "yes" || *it == "y") {
emit confirm(true);
} else if (*it == "no" || *it == "n") {
emit confirm(false);
} else if (*it == "save" || *it == "s") {
if (++it == list.end())
display("Expected filename as second argument.");
else
emit writeLogToDisk(*it);
} else if (*it == "help" || *it == "h" ) {
display("4DGo -- A four-dimensional goban for online play.");
display("All commands start with a '!'. Any input that does not is treated as a chat message. All comands are case-insensitive.");
display(" Commands:");
display("!connect [hostname] [port]: connect to the game server. By default, localhost:15493 will be used.");
display("!disconnect: break connection to server and clear the goban.");
display("!A4d4: on slice A4 (top-left), on intersection d4 (top-right).");
display("!pass: end your turn without playing a stone.");
display("!undo: request that your last move be undone.");
display("!yes: allow the action your opponent requested (usually an undo or kill).");
display("!yes: refuse to allow the action your opponent requested (usually an undo or kill).");
display("!kill: request a certain group to be immediately taken off the board. Useful in endgame, to not need to play out all captures.");
display("!save filename: save the current history to file filename.");
display("!exit: disconnect and close the window.");
} else {
tbCBox_->append(QString("Unknown command: ")+*it);
}
}
示例2: restoreWatches
void OCamlWatch::restoreWatches()
{
QStringList vars = Options::get_opt_strlst( objectName()+"_VARIABLES" );
for (QStringList::const_iterator itVar = vars.begin(); itVar != vars.end() ; ++itVar)
{
QString variable = *itVar;
++itVar;
bool displayed = itVar->toInt() != 0;
watch( variable, displayed );
}
}
示例3:
QList<int> Options::get_opt_intlst ( const QString &opt, const QList<int> &def )
{
QStringList defs;
for (QList<int>::const_iterator itDef = def.begin(); itDef != def.end(); ++itDef )
defs << QString::number( *itDef );
QStringList rets = get_opt_strlst( opt, defs );
QList<int> ret;
for (QStringList::const_iterator itStr = rets.begin(); itStr != rets.end(); ++itStr )
ret << itStr->toInt();
return ret;
}
示例4: readXML
void QgsDiagramSettings::readXML( const QDomElement& elem )
{
font.fromString( elem.attribute( "font" ) );
backgroundColor.setNamedColor( elem.attribute( "backgroundColor" ) );
backgroundColor.setAlpha( elem.attribute( "backgroundAlpha" ).toInt() );
size.setWidth( elem.attribute( "width" ).toDouble() );
size.setHeight( elem.attribute( "height" ).toDouble() );
penColor.setNamedColor( elem.attribute( "penColor" ) );
penWidth = elem.attribute( "penWidth" ).toDouble();
minScaleDenominator = elem.attribute( "minScaleDenominator", "-1" ).toDouble();
maxScaleDenominator = elem.attribute( "maxScaleDenominator", "-1" ).toDouble();
//mm vs map units
if ( elem.attribute( "sizeType" ) == "MM" )
{
sizeType = MM;
}
else
{
sizeType = MapUnits;
}
//colors
categoryColors.clear();
QStringList colorList = elem.attribute( "colors" ).split( "/" );
QStringList::const_iterator colorIt = colorList.constBegin();
for ( ; colorIt != colorList.constEnd(); ++colorIt )
{
categoryColors.append( QColor( *colorIt ) );
}
//attribute indices
categoryIndices.clear();
QStringList catList = elem.attribute( "categories" ).split( "/" );
QStringList::const_iterator catIt = catList.constBegin();
for ( ; catIt != catList.constEnd(); ++catIt )
{
categoryIndices.append( catIt->toInt() );
}
}
示例5: readXML
void QgsDiagramSettings::readXML( const QDomElement& elem )
{
font.fromString( elem.attribute( "font" ) );
backgroundColor.setNamedColor( elem.attribute( "backgroundColor" ) );
backgroundColor.setAlpha( elem.attribute( "backgroundAlpha" ).toInt() );
size.setWidth( elem.attribute( "width" ).toDouble() );
size.setHeight( elem.attribute( "height" ).toDouble() );
transparency = elem.attribute( "transparency", "0" ).toInt();
penColor.setNamedColor( elem.attribute( "penColor" ) );
int penAlpha = elem.attribute( "penAlpha", "255" ).toInt();
penColor.setAlpha( penAlpha );
penWidth = elem.attribute( "penWidth" ).toDouble();
minScaleDenominator = elem.attribute( "minScaleDenominator", "-1" ).toDouble();
maxScaleDenominator = elem.attribute( "maxScaleDenominator", "-1" ).toDouble();
//mm vs map units
if ( elem.attribute( "sizeType" ) == "MM" )
{
sizeType = MM;
}
else
{
sizeType = MapUnits;
}
//label placement method
if ( elem.attribute( "labelPlacementMethod" ) == "Height" )
{
labelPlacementMethod = Height;
}
else
{
labelPlacementMethod = XHeight;
}
// orientation
if ( elem.attribute( "diagramOrientation" ) == "Left" )
{
diagramOrientation = Left;
}
else if ( elem.attribute( "diagramOrientation" ) == "Right" )
{
diagramOrientation = Right;
}
else if ( elem.attribute( "diagramOrientation" ) == "Down" )
{
diagramOrientation = Down;
}
else
{
diagramOrientation = Up;
}
// scale dependency
if ( elem.attribute( "scaleDependency" ) == "Diameter" )
{
scaleByArea = false;
}
else
{
scaleByArea = true;
}
barWidth = elem.attribute( "barWidth" ).toDouble();
angleOffset = elem.attribute( "angleOffset" ).toInt();
minimumSize = elem.attribute( "minimumSize" ).toDouble();
//colors
categoryColors.clear();
QStringList colorList = elem.attribute( "colors" ).split( "/" );
QStringList::const_iterator colorIt = colorList.constBegin();
for ( ; colorIt != colorList.constEnd(); ++colorIt )
{
QColor newColor( *colorIt );
newColor.setAlpha( 255 - transparency );
categoryColors.append( QColor( newColor ) );
}
//attribute indices
categoryIndices.clear();
QStringList catList = elem.attribute( "categories" ).split( "/" );
QStringList::const_iterator catIt = catList.constBegin();
for ( ; catIt != catList.constEnd(); ++catIt )
{
categoryIndices.append( catIt->toInt() );
}
}