本文整理汇总了C++中qstringlist::Iterator::split方法的典型用法代码示例。如果您正苦于以下问题:C++ Iterator::split方法的具体用法?C++ Iterator::split怎么用?C++ Iterator::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qstringlist::Iterator
的用法示例。
在下文中一共展示了Iterator::split方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: 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);
}