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


C++ QStringRef::isNull方法代码示例

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


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

示例1: generateGraphics

ViewItem* LabelItemFactory::generateGraphics(QXmlStreamReader& xml, ObjectStore *store, View *view, ViewItem *parent) {
  LabelItem *rc = 0;
  while (!xml.atEnd()) {
    bool validTag = true;
    if (xml.isStartElement()) {
      if (!rc && xml.name().toString() == "label") {
      QXmlStreamAttributes attrs = xml.attributes();
      QStringRef av;
      av = attrs.value("text");
      if (!av.isNull()) {
        Q_ASSERT(!rc);
        rc = new LabelItem(view, av.toString());
        if (parent) {
          rc->setParentViewItem(parent);
         // Add any new specialized LabelItem Properties here.
          }
        }
        av = attrs.value("scale");
        if (!av.isNull()) {
          rc->setLabelScale(QVariant(av.toString()).toInt());
        }
        av = attrs.value("color");
        if (!av.isNull()) {
            rc->setLabelColor(QColor(av.toString()));
        }
        av = attrs.value("font");
        if (!av.isNull()) {
          QFont font;
          font.fromString(av.toString());
          rc->setLabelFont(font);
        }
        av = attrs.value("fixleft");
        if (!av.isNull()) {
          rc->setFixLeft(QVariant(av.toString()).toBool());
        }
      } else {
        Q_ASSERT(rc);
        if (!rc->parse(xml, validTag) && validTag) {
          ViewItem *i = GraphicsFactory::parse(xml, store, view, rc);
          if (!i) {
          }
        }
      }
    } else if (xml.isEndElement()) {
      if (xml.name().toString() == "label") {
        break;
      } else {
        validTag = false;
      }
    }
    if (!validTag) {
      qDebug("invalid Tag\n");
      Debug::self()->log(QObject::tr("Error creating box object from Kst file."), Debug::Warning);
      delete rc;
      return 0;
    }
    xml.readNext();
  }
  return rc;
}
开发者ID:jmlee4301,项目名称:kst,代码行数:60,代码来源:labelitem.cpp

示例2: configurePropertiesFromXml

    virtual bool configurePropertiesFromXml(Kst::ObjectStore *store, QXmlStreamAttributes& attrs) {
      bool validTag = true;

      setObjectStore(store);

      QStringRef av;
      bool force_offset = false;
      av = attrs.value("ForceOffset");
      if (!av.isNull()) {
        force_offset = QVariant(av.toString()).toBool();
      }
      _forceOffset->setChecked(force_offset);
//      if (force_offset) {
//   The tickets will also be taken care of.     av = attrs.value("Offset");
//        if (!av.isNull()) {
//          QString name = av.toString();
//          Kst::ObjectPtr object = store->retrieveObject(name);
//          Kst::ScalarPtr scalar = Kst::kst_cast<Kst::Scalar>(object);
//          setScalarOffset(scalar);
//        }

//      }

      return validTag;
    }
开发者ID:Kst-plot,项目名称:kst,代码行数:25,代码来源:fitgaussian_unweighted.cpp

示例3: recurseParse

void XMLTools::recurseParse(QXmlStreamReader &reader,
							QXmlStreamWriter &writer,
							int &paragraphs,
							const QMap<QString, QString> &opstyle,
							const int close,
							bool ignore) {
	while (! reader.atEnd()) {
		QXmlStreamReader::TokenType tt = reader.readNext();

		QXmlStreamAttributes a = reader.attributes();
		QMap<QString, QString> style;
		QMap<QString, QString> pstyle = opstyle;

		QStringRef styleref = a.value(QLatin1String("style"));
		if (!styleref.isNull()) {
			QString stylestring = styleref.toString();
			QStringList styles = stylestring.split(QLatin1String(";"), QString::SkipEmptyParts);
			foreach(QString s, styles) {
				s = s.simplified();
				int idx = s.indexOf(QLatin1Char(':'));
				QString key = (idx > 0) ? s.left(idx).simplified() : s;
				QString val = (idx > 0) ? s.mid(idx+1).simplified() : QString();

				if (! pstyle.contains(key) || (pstyle.value(key) != val)) {
					style.insert(key,val);
					pstyle.insert(key,val);
				}
			}
		}
开发者ID:Abextm,项目名称:mumble,代码行数:29,代码来源:XMLTools.cpp

示例4: mDid

EwsId::EwsId(QXmlStreamReader &reader)
    : mDid(EwsDIdCalendar)
{
    // Don't check for this element's name as a folder id may be contained in several elements
    // such as "FolderId" or "ParentFolderId".
    const QXmlStreamAttributes &attrs = reader.attributes();

    QStringRef idRef = attrs.value(QStringLiteral("Id"));
    QStringRef changeKeyRef = attrs.value(QStringLiteral("ChangeKey"));
    if (idRef.isNull())
        return;

    mId = idRef.toString();
    if (!changeKeyRef.isNull())
        mChangeKey = changeKeyRef.toString();
#ifdef HAVE_INBOX_FILTERING_WORKAROUND
    if (mId == inboxId) {
        mId = QStringLiteral("INBOX");
    }
#endif
    mType = Real;
}
开发者ID:KrissN,项目名称:akonadi-ews,代码行数:22,代码来源:ewsid.cpp

示例5: check

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

示例6: check

void SpellChecker::check()
{
	setDisabled(true);
	QProgressDialog wait_dialog(tr("Checking spelling..."), tr("Cancel"), 0, m_document->document()->characterCount(), this);
	wait_dialog.setWindowTitle(tr("Please wait"));
	wait_dialog.setValue(0);
	wait_dialog.setWindowModality(Qt::WindowModal);

	forever {
		// Update wait dialog
		wait_dialog.setValue(m_cursor.position());
		if (wait_dialog.wasCanceled()) {
			m_document->setTextCursor(m_start_cursor);
			reject();
		}

		// 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);
				continue;
			} 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:quickhand,项目名称:Prosit,代码行数:61,代码来源:spell_checker.cpp


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