本文整理汇总了C++中ktexteditor::Range::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Range::isEmpty方法的具体用法?C++ Range::isEmpty怎么用?C++ Range::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::Range
的用法示例。
在下文中一共展示了Range::isEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeText
void TextBuffer::removeText (const KTextEditor::Range &range)
{
// only allowed if editing transaction running
Q_ASSERT (m_editingTransactions > 0);
// only ranges on one line are supported
Q_ASSERT (range.start().line() == range.end().line());
// start colum <= end column and >= 0
Q_ASSERT (range.start().column() <= range.end().column());
Q_ASSERT (range.start().column() >= 0);
// skip work, if no text to remove
if (range.isEmpty())
return;
// get block, this will assert on invalid line
int blockIndex = blockForLine (range.start().line());
// let the block handle the removeText, retrieve removed text
QString text;
m_blocks.at(blockIndex)->removeText (range, text);
// remember changes
++m_revision;
// update changed line interval
if (range.start().line() < m_editingMinimalLineChanged || m_editingMinimalLineChanged == -1)
m_editingMinimalLineChanged = range.start().line();
if (range.start().line() > m_editingMaximalLineChanged)
m_editingMaximalLineChanged = range.start().line();
// emit signal about done change
emit textRemoved (range, text);
}