本文整理汇总了C++中ktexteditor::Range::setEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ Range::setEnd方法的具体用法?C++ Range::setEnd怎么用?C++ Range::setEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::Range
的用法示例。
在下文中一共展示了Range::setEnd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rangeCheck
void RangeTest::rangeCheck(KTextEditor::Range &valid)
{
QVERIFY(valid.isValid() && valid.start() <= valid.end());
KTextEditor::Cursor before(0, 1), start(0, 2), end(1, 4), after(1, 10);
KTextEditor::Range result(start, end);
QVERIFY(valid.isValid() && valid.start() <= valid.end());
valid.setRange(start, end);
QVERIFY(valid.isValid() && valid.start() <= valid.end());
QCOMPARE(valid, result);
valid.setRange(end, start);
QVERIFY(valid.isValid() && valid.start() <= valid.end());
QCOMPARE(valid, result);
valid.setStart(after);
QVERIFY(valid.isValid() && valid.start() <= valid.end());
QCOMPARE(valid, KTextEditor::Range(after, after));
valid = result;
QCOMPARE(valid, result);
valid.setEnd(before);
QVERIFY(valid.isValid() && valid.start() <= valid.end());
QCOMPARE(valid, KTextEditor::Range(before, before));
}
示例2: execute
void NormalDeclarationCompletionItem::execute(KTextEditor::View* view, const KTextEditor::Range& word) {
if( m_completionContext && m_completionContext->depth() != 0 )
return; //Do not replace any text when it is an argument-hint
KTextEditor::Document* document = view->document();
QString newText;
{
KDevelop::DUChainReadLocker lock(KDevelop::DUChain::lock());
if(m_declaration) {
newText = declarationName();
} else {
qCDebug(LANGUAGE) << "Declaration disappeared";
return;
}
}
document->replaceText(word, newText);
KTextEditor::Range newRange = word;
newRange.setEnd(KTextEditor::Cursor(newRange.end().line(), newRange.start().column() + newText.length()));
executed(view, newRange);
}