当前位置: 首页>>代码示例>>C++>>正文


C++ QStringRef类代码示例

本文整理汇总了C++中QStringRef的典型用法代码示例。如果您正苦于以下问题:C++ QStringRef类的具体用法?C++ QStringRef怎么用?C++ QStringRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QStringRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void DocxReader::readParagraphProperties(Style& style, bool allowstyles)
{
	int left_indent = 0, right_indent = 0, indent = 0;
	bool textdir = false;
	while (m_xml.readNextStartElement()) {
		QStringRef value = m_xml.attributes().value("w:val");
		if (m_xml.qualifiedName() == "w:jc") {
			// ECMA-376 1st edition, ECMA-376 2nd edition transitional, ISO/IEC 29500 transitional
			if (value == "left") {
				style.block_format.setAlignment(!textdir ? Qt::AlignLeading : (Qt::AlignLeft | Qt::AlignAbsolute));
			} else if (value == "right") {
				style.block_format.setAlignment(!textdir ? Qt::AlignTrailing : (Qt::AlignRight | Qt::AlignAbsolute));
			// ECMA-376, ISO/IEC 29500 strict
			} else if (value == "center") {
				style.block_format.setAlignment(Qt::AlignCenter);
			} else if (value == "both") {
				style.block_format.setAlignment(Qt::AlignJustify);
			// ECMA-376 2nd edition, ISO/IEC 29500 strict
			} else if (value == "start") {
				style.block_format.setAlignment(Qt::AlignLeading);
			} else if (value == "end") {
				style.block_format.setAlignment(Qt::AlignTrailing);
			}
		} else if (m_xml.qualifiedName() == "w:ind") {
			// ECMA-376 1st edition, ECMA-376 2nd edition transitional, ISO/IEC 29500 transitional
			left_indent = std::lround(m_xml.attributes().value("w:left").toString().toDouble() / 720.0);
			right_indent = std::lround(m_xml.attributes().value("w:right").toString().toDouble() / 720.0);
			// ECMA-376 2nd edition, ISO/IEC 29500 strict
			indent = std::lround(m_xml.attributes().value("w:start").toString().toDouble() / 720.0);
			if (indent) {
				style.block_format.setIndent(indent);
				left_indent = right_indent = 0;
			}
		} else if (m_xml.qualifiedName() == "w:bidi") {
			if (readBool(m_xml.attributes().value("w:val"))) {
				style.block_format.setLayoutDirection(Qt::RightToLeft);
			}
		} else if (m_xml.qualifiedName() == "w:textDirection") {
			if (value == "rl") {
				textdir = true;
				style.block_format.setLayoutDirection(Qt::RightToLeft);
			} else if (value == "lr") {
				style.block_format.setLayoutDirection(Qt::LeftToRight);
			}
		} else if (m_xml.qualifiedName() == "w:outlineLvl") {
			int heading = m_xml.attributes().value("w:val").toString().toInt();
			if (heading != 9) {
				style.block_format.setProperty(QTextFormat::UserProperty, qBound(1, heading + 1, 6));
			}
		} else if ((m_xml.qualifiedName() == "w:pStyle") && allowstyles) {
			Style pstyle = m_styles.value(value.toString());
			pstyle.merge(style);
			style = pstyle;
		} else if (m_xml.qualifiedName() == "w:rPr") {
			readRunProperties(style);
			continue;
		}

		m_xml.skipCurrentElement();
	}

	if (!indent) {
		if (style.block_format.layoutDirection() != Qt::RightToLeft) {
			if (left_indent) {
				style.block_format.setIndent(left_indent);
			}
		} else {
			if (right_indent) {
				style.block_format.setIndent(right_indent);
			}
		}
	}

	if (style.block_format.property(QTextFormat::UserProperty).toInt()) {
		style.char_format.setFontWeight(QFont::Normal);
	}
}
开发者ID:barak,项目名称:focuswriter,代码行数:77,代码来源:docx_reader.cpp

示例2: getExpandedLinkTextWithEntities

TextWithEntities MentionNameClickHandler::getExpandedLinkTextWithEntities(ExpandLinksMode mode, int entityOffset, const QStringRef &textPart) const {
	auto data = QString::number(_userId) + '.' + QString::number(_accessHash);
	return simpleTextWithEntity({ EntityInTextMentionName, entityOffset, textPart.size(), data });
}
开发者ID:VBelozyorov,项目名称:tdesktop,代码行数:4,代码来源:click_handler_types.cpp

示例3: setDisabled

void SpellChecker::check()
{
	setDisabled(true);

	QProgressDialog wait_dialog(tr("Checking spelling..."), tr("Cancel"), 0, m_total_blocks, this);
	wait_dialog.setWindowTitle(tr("Please wait"));
	wait_dialog.setValue(0);
	wait_dialog.setWindowModality(Qt::WindowModal);
	bool canceled = false;

	forever {
		// Update wait dialog
		wait_dialog.setValue(m_checked_blocks);
		if (wait_dialog.wasCanceled()) {
			canceled = true;
			break;
		}

		// Check current line
		QTextBlock block = m_cursor.block();
		QStringRef word =  m_dictionary.check(block.text(), m_cursor.position() - block.position());
		if (word.isNull()) {
			if (block.next().isValid()) {
				m_cursor.movePosition(QTextCursor::NextBlock);
				++m_checked_blocks;
				if (m_checked_blocks < m_total_blocks) {
					continue;
				} else {
					break;
				}
			} else if (m_loop_available) {
				wait_dialog.reset();
				if (QMessageBox::question(this, QString(), tr("Continue checking at beginning of file?"),
						QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
					m_loop_available = false;
					m_cursor.movePosition(QTextCursor::Start);
					wait_dialog.setRange(0, m_total_blocks);
					continue;
				} else {
					canceled = true;
					break;
				}
			} else {
				break;
			}
		}

		// Select misspelled word
		m_cursor.setPosition(word.position() + block.position());
		m_cursor.setPosition(m_cursor.position() + word.length(), QTextCursor::KeepAnchor);
		m_word = m_cursor.selectedText();

		if (!m_ignored.contains(m_word)) {
			wait_dialog.close();
			setEnabled(true);

			// Show misspelled word in context
			QTextCursor cursor = m_cursor;
			cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor, 10);
			int end = m_cursor.position() - cursor.position();
			int start = end - m_word.length();
			cursor.movePosition(QTextCursor::NextWord, QTextCursor::KeepAnchor, 21);
			QString context = cursor.selectedText();
			context.insert(end, "</span>");
			context.insert(start, "<span style=\"color: red;\">");
			context.replace("\n", "</p><p>");
			context.replace("\t", "<span style=\"white-space: pre;\">\t</span>");
			context = "<p>" + context + "</p>";
			m_context->setHtml(context);

			// Show suggestions
			m_suggestion->clear();
			m_suggestions->clear();
			QStringList words = m_dictionary.suggestions(m_word);
			if (!words.isEmpty()) {
				foreach (const QString& word, words) {
					m_suggestions->addItem(word);
				}
				m_suggestions->setCurrentRow(0);
			}
开发者ID:glenux,项目名称:contrib-focuswriter,代码行数:80,代码来源:spell_checker.cpp

示例4: foreach

bool QmcTypeUnitComponentAndAliasResolver::addAliases()
{
    // add aliases
    //QmcUnitAlias al = {0, 0, 0, 8, 0, 0, 24};
    //qmcTypeUnit->unit->aliases.append(al);
    // see QQmlComponentAndAliasResolver::resolve
    int effectiveAliasIndex = -1;
    int effectivePropertyIndex = -1;
    int effectiveSignalIndex = -1;
    int currentObjectIndex = -1;
    QQmlPropertyCache *propertyCache = NULL;
    foreach (const QmcUnitAlias &alias, qmcTypeUnit->unit->aliases) {
        if ((int)alias.objectIndex != currentObjectIndex) {
            currentObjectIndex = alias.objectIndex;
            effectiveAliasIndex = 0;
            propertyCache = qmcTypeUnit->propertyCaches.at(alias.objectIndex);
            effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count();
            effectiveSignalIndex = propertyCache->signalHandlerIndexCacheStart + propertyCache->propertyIndexCache.count();
        }
        Q_ASSERT(propertyCache);
        QQmlVMEMetaData::AliasData aliasData;
        aliasData.contextIdx = alias.contextIndex;
        aliasData.propertyIdx = alias.targetPropertyIndex;
        aliasData.propType = alias.propertyType;
        aliasData.flags = alias.flags;
        aliasData.notifySignal = alias.notifySignal;

        typedef QQmlVMEMetaData VMD;
        QByteArray &dynamicData = qmcTypeUnit->vmeMetaObjects[alias.objectIndex];
        Q_ASSERT(!dynamicData.isEmpty());
        VMD *vmd = (QQmlVMEMetaData *)dynamicData.data();
        *(vmd->aliasData() + effectiveAliasIndex++) = aliasData;

        Q_ASSERT(dynamicData.isDetached());

        // TBD: propertyCache
        const QV4::CompiledData::Object *obj = qmcTypeUnit->compiledData->qmlUnit->objectAt(alias.objectIndex);
        Q_ASSERT(obj);
        Q_ASSERT(alias.propertyIndex < obj->nProperties);
        const QV4::CompiledData::Property *p = &obj->propertyTable()[alias.propertyIndex];
        Q_ASSERT(p);
        QString propertyName = qmcTypeUnit->stringAt(p->nameIndex);
        const QString aliasPropertyValue = qmcTypeUnit->stringAt(p->aliasPropertyValueIndex);

        //const int idIndex = p->aliasIdValueIndex;
        const int targetObjectIndex = alias.targetObjectIndex;
#if 0
        const int idIndex = p->aliasIdValueIndex;
        const int targetObjectIndex = _idToObjectIndex.value(idIndex, -1);
        if (targetObjectIndex == -1) {
            recordError(p->aliasLocation, tr("Invalid alias reference. Unable to find id \"%1\"").arg(stringAt(idIndex)));
            return false;
        }
#endif
        QStringRef property;
        QStringRef subProperty;

        const int propertySeparator = aliasPropertyValue.indexOf(QLatin1Char('.'));
        if (propertySeparator != -1) {
            property = aliasPropertyValue.leftRef(propertySeparator);
            subProperty = aliasPropertyValue.midRef(propertySeparator + 1);
        } else
            property = QStringRef(&aliasPropertyValue, 0, aliasPropertyValue.length());

        quint32 propertyFlags = QQmlPropertyData::IsAlias;
        int type = 0;
        bool writable = false;
        bool resettable = false;

        if (property.isEmpty()) {
            const QV4::CompiledData::Object *targetObject = qmcTypeUnit->compiledData->qmlUnit->objectAt(targetObjectIndex);
            QQmlCompiledData::TypeReference *typeRef = qmcTypeUnit->compiledData->resolvedTypes.value(targetObject->inheritedTypeNameIndex);
            Q_ASSERT(typeRef);

            if (typeRef->type)
                type = typeRef->type->typeId();
            else
                type = typeRef->component->metaTypeId;

            //flags |= QML_ALIAS_FLAG_PTR;
            propertyFlags |= QQmlPropertyData::IsQObjectDerived;
        } else {
            QQmlPropertyCache *targetCache = qmcTypeUnit->propertyCaches.at(targetObjectIndex);
            Q_ASSERT(targetCache);
            QmlIR::PropertyResolver resolver(targetCache);

            QQmlPropertyData *targetProperty = resolver.property(property.toString());
            if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
                return false;
            }

            //propIdx = targetProperty->coreIndex;
            type = targetProperty->propType;

            writable = targetProperty->isWritable();
            resettable = targetProperty->isResettable();
            //notifySignal = targetProperty->notifyIndex;

            if (!subProperty.isEmpty()) {
                QQmlValueType *valueType = QQmlValueTypeFactory::valueType(type);
//.........这里部分代码省略.........
开发者ID:RichardsATcn,项目名称:qmlc,代码行数:101,代码来源:qmctypeunitcomponentandaliasresolver.cpp

示例5: oCurrentFile

bool Metalink4Handler::parseFile( QList<MetaFile>& lFiles, quint16 ID )
{
	MetaFile oCurrentFile( ID );

	while ( m_oMetaLink.readNextStartElement() )
	{
		QStringRef sComp = m_oMetaLink.name();
		QXmlStreamAttributes vAttributes = m_oMetaLink.attributes();

		if ( !sComp.compare( "hash" ) )
		{
			if ( vAttributes.hasAttribute( "type" ) )
			{
				const QString sType = vAttributes.value( "type" ).toString().trimmed();
				const QString sUrn = "urn:" + sType + ":" + m_oMetaLink.readElementText();
				Hash* pHash = Hash::fromURN( sUrn );

				if ( pHash )
				{
					if ( !oCurrentFile.m_vHashes.insert( pHash ) )
					{
						postParsingInfo( m_oMetaLink.lineNumber(),
										 tr( "Found and ignored conflicting hash of type \"%1\" within <hash> tag." ).arg( sType ) );
					}
				}
				else
				{
					postParsingInfo( m_oMetaLink.lineNumber(),
									 tr( "Found unsupported hash of type \"%1\" within <hash> tag." ).arg( sType ) );
					continue;
				}
			}
			else
			{
				postParsingError( m_oMetaLink.lineNumber(),
								  tr( "<hash> tag is missing type specification." ) );
				continue;
			}
		}
		else if ( !sComp.compare( "url" ) )
		{
			MediaURI uri;
			uri.m_nType = uriURL;
			uri.m_pURL = new QUrl( m_oMetaLink.readElementText() );

			if ( uri.m_pURL->isValid() )
			{
				if ( vAttributes.hasAttribute( "location" ) )
				{
					uri.m_sLocation = vAttributes.value( "location" ).toString().trimmed();
				}

				if ( vAttributes.hasAttribute( "priority" ) )
				{
					bool bOK;
					quint16 nPriority = vAttributes.value( "priority" ).toString().toUShort( &bOK );

					if ( bOK && nPriority < 256 )
					{
						uri.m_nPriority = nPriority;
					}
					else
					{
						postParsingError( m_oMetaLink.lineNumber(),
										  tr( "\"priority\" attribute within <url> tag could not be parsed." ) );
					}
				}

				oCurrentFile.m_lURIs.append( uri );
			}
			else
			{
				postParsingError( m_oMetaLink.lineNumber(),
								  tr( "Could not parse invalid URL: %1" ).arg( uri.m_pURL->toString() ) );
				delete uri.m_pURL;
				continue;
			}
		}
		else if ( !sComp.compare( "size" ) )
		{
			bool bOK;
			quint64 nFileSize = m_oMetaLink.readElementText().toULongLong( &bOK );

			if ( bOK )
			{
				oCurrentFile.m_nFileSize = nFileSize;
			}
			else
			{
				postParsingError( m_oMetaLink.lineNumber(),
								  tr( "<size> tag could not be parsed." ) );
				continue;
			}
		}
		else if ( !sComp.compare( "identity" ) )
		{
			oCurrentFile.m_sIdentity = m_oMetaLink.readElementText();
		}
		else if ( !sComp.compare( "description" ) )
		{
//.........这里部分代码省略.........
开发者ID:rusingineer,项目名称:quazaa,代码行数:101,代码来源:metalink4handler.cpp

示例6: return

quint64 BaseStateAbstract::readUInt64(QStringRef val, bool *ok)
{
    return (quint64)val.toString().toULongLong(ok);
}
开发者ID:metrodango,项目名称:pip3line,代码行数:4,代码来源:basestateabstract.cpp

示例7: while

/*!
 * Read out a widget within a category. This can either be
 * enclosed in a <ui> element or a (legacy) <widget> element which may
 * contain nested <widget> elements.
 *
 * Examples:
 *
 * <ui language="c++">
 *  <widget class="MultiPageWidget" name="multipagewidget"> ... </widget>
 *  <customwidgets>...</customwidgets>
 * <ui>
 *
 * or
 *
 * <widget>
 *   <widget> ... </widget>
 *   ...
 * <widget>
 *
 * Returns true on success, false if end was reached or an error has been encountered
 * in which case the reader has its error flag set. If successful, the current item
 * of the reader will be the closing element (</ui> or </widget>)
 */
bool WidgetBoxTreeWidget::readWidget(Widget *w, const QString &xml, QXmlStreamReader &r)
{
    qint64 startTagPosition =0, endTagPosition = 0;

    int nesting = 0;
    bool endEncountered = false;
    bool parsedWidgetTag = false;
    QString outmostElement;
    while (!endEncountered) {
        const qint64 currentPosition = r.characterOffset();
        switch(r.readNext()) {
        case QXmlStreamReader::StartElement:
            if (nesting++ == 0) {
                // First element must be <ui> or (legacy) <widget>
                const QStringRef name = r.name();
                if (name == QLatin1String(uiElementC)) {
                    startTagPosition = currentPosition;
                } else {
                    if (name == QLatin1String(widgetElementC)) {
                        startTagPosition = currentPosition;
                        parsedWidgetTag = true;
                    } else {
                        r.raiseError(QDesignerWidgetBox::tr("Unexpected element <%1> encountered when parsing for <widget> or <ui>").arg(name.toString()));
                        return false;
                    }
                }
            } else {
                // We are within <ui> looking for the first <widget> tag
                if (!parsedWidgetTag && r.name() == QLatin1String(widgetElementC)) {
                    parsedWidgetTag = true;
                }
            }
            break;
        case QXmlStreamReader::EndElement:
            // Reached end of widget?
            if (--nesting == 0)  {
                endTagPosition = r.characterOffset();
                endEncountered = true;
            }
            break;
        case QXmlStreamReader::EndDocument:
            r.raiseError(QDesignerWidgetBox::tr("Unexpected end of file encountered when parsing widgets."));
            return false;
        case QXmlStreamReader::Invalid:
            return false;
        default:
            break;
        }
    }
    if (!parsedWidgetTag) {
        r.raiseError(QDesignerWidgetBox::tr("A widget element could not be found."));
        return false;
    }
    // Oddity: Startposition is 1 off
    QString widgetXml = xml.mid(startTagPosition, endTagPosition - startTagPosition);
    const QChar lessThan = QLatin1Char('<');
    if (!widgetXml.startsWith(lessThan))
        widgetXml.prepend(lessThan);
    w->setDomXml(widgetXml);
    return true;
}
开发者ID:urmilabiplab,项目名称:qt5-qttools-nacl,代码行数:84,代码来源:widgetboxtreewidget.cpp

示例8: input

void Utilisateur::loadParam(){
    QFile input("../parametres.xml");

    if(input.open(QIODevice::ReadOnly)){
        QXmlStreamReader xml(&input);
        while(!xml.atEnd() && !xml.hasError()){

            if(xml.isStartElement() && xml.name()=="Type"){
                QXmlStreamAttributes attr = xml.attributes();
                QStringRef entier = attr.value("Entier");
                QStringRef reel = attr.value("Reel");
                QStringRef rationnel = attr.value("Rationnel");
                QStringRef complexe = attr.value("Complexe");
                QStringRef degre = attr.value("Degre");

                if(entier=="True")
                    _entier=true;
                else
                    _entier=false;

                if(reel=="True")
                    _reel=true;
                else
                    _reel=false;

                if(rationnel=="True")
                    _rationnel=true;
                else
                    _rationnel=false;

                if(complexe=="True")
                    _complexe=true;
                else
                    _complexe=false;

                if(degre=="True")
                    _degre=true;
                else
                    _degre=false;

            }
            else if(xml.isStartElement() && xml.name()=="Pile"){
                QXmlStreamAttributes attr = xml.attributes();
                QStringRef x = attr.value("X");
                QStringRef affichage = attr.value("Affichage");
                QString xstr = x.toString();

                if(xstr.contains(QRegExp("^[0-9]+$")))
                    _X = xstr.toInt();
                else
                    _X=10;

                if(affichage=="True")
                    _pile=true;
                else
                    _pile=false;
            }
            else if(xml.isStartElement() && xml.name()=="Clavier"){
                QXmlStreamAttributes attr = xml.attributes();
                QStringRef affichage = attr.value("Affichage");
                if(affichage=="True")
                    _clavier=true;
                else
                    _clavier=false;
            }
            //lit l'element suivant
            xml.readNext();
        }
    }
    input.close();
}
开发者ID:martinni,项目名称:Calculatrice,代码行数:71,代码来源:utilisateur.cpp

示例9: xmlFile

bool DialogStartup::populateListWidget(QListWidget* lw,QString configPath) {
    QFile xmlFile(configPath);

    if (!xmlFile.exists() || (xmlFile.error() != QFile::NoError)) {
        qDebug() << "ERROR: Unable to open config file " << configPath;
        return false;
    }

    xmlFile.open(QIODevice::ReadOnly);
    QXmlStreamReader reader(&xmlFile);
    while (!reader.atEnd()) {
        reader.readNext();

        if (reader.isStartElement()) {
            if (reader.name() == "demos")
                while (!reader.atEnd()) {
                    reader.readNext();
                    if (reader.isStartElement() && reader.name() == "example") {
                        QXmlStreamAttributes attrs = reader.attributes();
                        QStringRef filename = attrs.value("filename");
                        if (!filename.isEmpty()) {
                            QStringRef name = attrs.value("name");
                            QStringRef image = attrs.value("image");
                            QStringRef args = attrs.value("args");
                            QStringRef idpocket = attrs.value("idpocket");
                            QStringRef desc = attrs.value("desc");
                            QStringRef _connectortype = attrs.value("connectortype");
                            QStringRef _conngender = attrs.value("conngender");

                            QListWidgetItem *newItem = new QListWidgetItem;
                            newItem->setText(name.toString());
                            newItem->setIcon(QIcon(image.toString()));
                            newItem->setData(Qt::UserRole,idpocket.toString());

                            if (!idpocket.startsWith("#"))
                                lw->addItem( newItem);

                            // filter on connectors type and gender

//                            if (!connType.isEmpty() && (_connectortype.indexOf(connType)==-1)) continue;
           //                 qWarning()<<connType<<" found:"<<_connectortype;
//                            if (!connGender.isEmpty() && (_conngender.indexOf(connGender)==-1)) continue;
           //                 qWarning()<<"included";


                        }
                    } else if(reader.isEndElement() && reader.name() == "demos") {
                        return true;
                    }
                }
        }
    }

    if (reader.hasError()) {
       qDebug() << QString("Error parsing %1 on line %2 column %3: \n%4")
                .arg(configPath)
                .arg(reader.lineNumber())
                .arg(reader.columnNumber())
                .arg(reader.errorString());
    }

    return true;
}
开发者ID:pockemul,项目名称:PockEmul,代码行数:63,代码来源:dialogstartup.cpp

示例10: parseRootElement

bool QGeoCodeXmlParser::parseRootElement()
{
    /*
    <xsd:element name="places">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="0" maxOccurs="unbounded" name="place" type="gc:Place"/>
            </xsd:sequence>
            <xsd:attribute name="resultCode" type="gc:ResultCodes"/>
            <xsd:attribute name="resultDescription" type="xsd:string"/>
            <xsd:attribute name="resultsTotal" type="xsd:nonNegativeInteger"/>
        </xsd:complexType>
    </xsd:element>

    <xsd:simpleType name="ResultCodes">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="OK"/>
            <xsd:enumeration value="FAILED"/>
        </xsd:restriction>
    </xsd:simpleType>
    */

    if (m_reader->readNextStartElement()) {
        if (m_reader->name() == "places") {
            if (m_reader->attributes().hasAttribute("resultCode")) {
                QStringRef result = m_reader->attributes().value("resultCode");
                if (result == "FAILED") {
                    QString resultDesc = m_reader->attributes().value("resultDescription").toString();
                    if (resultDesc.isEmpty())
                        resultDesc = "The attribute \"resultCode\" of the element \"places\" indicates that the request failed.";

                    m_reader->raiseError(resultDesc);

                    return false;
                } else if (result != "OK") {
                    m_reader->raiseError(QString("The attribute \"resultCode\" of the element \"places\" has an unknown value (value was %1).").arg(result.toString()));
                    return false;
                }
            }

            while (m_reader->readNextStartElement()) {
                if (m_reader->name() == "place") {
                    QGeoLocation location;

                    if (!parsePlace(&location))
                        return false;

                    if (!m_bounds.isValid() || m_bounds.contains(location.coordinate()))
                        m_results.append(location);
                } else {
                    m_reader->raiseError(QString("The element \"places\" did not expect a child element named \"%1\".").arg(m_reader->name().toString()));
                    return false;
                }
            }
        } else {
            m_reader->raiseError(QString("The root element is expected to have the name \"places\" (root element was named \"%1\").").arg(m_reader->name().toString()));
            return false;
        }
    } else {
        m_reader->raiseError("Expected a root element named \"places\" (no root element found).");
        return false;
    }

    if (m_reader->readNextStartElement()) {
        m_reader->raiseError(QString("A single root element named \"places\" was expected (second root element was named \"%1\")").arg(m_reader->name().toString()));
        return false;
    }

    return true;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:70,代码来源:qgeocodexmlparser.cpp

示例11: handleCharacterData

	void TuneFactory::handleCharacterData(const QStringRef &text)
	{
		if(m_depth == 2 && m_state != TuneInvalid)
			m_data[m_state] = text.toString();
	}
开发者ID:NeutronStein,项目名称:jreen,代码行数:5,代码来源:tunefactory.cpp

示例12: handleCharacterData

void ZLibCompressionFeature::handleCharacterData(const QStringRef &text)
{
    if (m_state == AtMethod)
        m_methods << text.toString();
}
开发者ID:jefferai,项目名称:jreen,代码行数:5,代码来源:zlibcompressionfeature.cpp

示例13: isPPKeyword

bool GlslHighlighter::isPPKeyword(const QStringRef &text) const
{
    switch (text.length())
    {
    case 2:
        if (text.at(0) == QLatin1Char('i') && text.at(1) == QLatin1Char('f'))
            return true;
        break;

    case 4:
        if (text.at(0) == QLatin1Char('e') && text == QLatin1String("elif"))
            return true;
        else if (text.at(0) == QLatin1Char('e') && text == QLatin1String("else"))
            return true;
        break;

    case 5:
        if (text.at(0) == QLatin1Char('i') && text == QLatin1String("ifdef"))
            return true;
        else if (text.at(0) == QLatin1Char('u') && text == QLatin1String("undef"))
            return true;
        else if (text.at(0) == QLatin1Char('e') && text == QLatin1String("endif"))
            return true;
        else if (text.at(0) == QLatin1Char('e') && text == QLatin1String("error"))
            return true;
        break;

    case 6:
        if (text.at(0) == QLatin1Char('i') && text == QLatin1String("ifndef"))
            return true;
        if (text.at(0) == QLatin1Char('i') && text == QLatin1String("import"))
            return true;
        else if (text.at(0) == QLatin1Char('d') && text == QLatin1String("define"))
            return true;
        else if (text.at(0) == QLatin1Char('p') && text == QLatin1String("pragma"))
            return true;
        break;

    case 7:
        if (text.at(0) == QLatin1Char('i') && text == QLatin1String("include"))
            return true;
        else if (text.at(0) == QLatin1Char('w') && text == QLatin1String("warning"))
            return true;
        break;

    case 12:
        if (text.at(0) == QLatin1Char('i') && text == QLatin1String("include_next"))
            return true;
        break;

    default:
        break;
    }

    return false;
}
开发者ID:55171514,项目名称:qtcreator,代码行数:56,代码来源:glslhighlighter.cpp

示例14: stringToColor

QColor BaseStateAbstract::stringToColor(QStringRef val)
{
    return stringToColor(val.toString());
}
开发者ID:metrodango,项目名称:pip3line,代码行数:4,代码来源:basestateabstract.cpp

示例15: attribute

void XmlQueryToWriter::attribute(const QXmlName & name, const QStringRef & value)
{
	_writer->writeAttribute(name.localName(_query->namePool()), value.toString());
}
开发者ID:ZhaoweiDing,项目名称:UniSim,代码行数:4,代码来源:xml_query_to_writer.cpp


注:本文中的QStringRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。