本文整理汇总了C++中QTextDocument::docHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::docHandle方法的具体用法?C++ QTextDocument::docHandle怎么用?C++ QTextDocument::docHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextDocument
的用法示例。
在下文中一共展示了QTextDocument::docHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addOverlaySelection
void TextEditorOverlay::addOverlaySelection(int begin, int end,
const QColor &fg, const QColor &bg,
uint overlaySelectionFlags)
{
if (end < begin)
return;
QTextDocument *document = m_editor->document();
OverlaySelection selection;
selection.m_fg = fg;
selection.m_bg = bg;
selection.m_cursor_begin = QTextCursor(document->docHandle(), begin);
selection.m_cursor_end = QTextCursor(document->docHandle(), end);
if (overlaySelectionFlags & ExpandBegin)
selection.m_cursor_begin.setKeepPositionOnInsert(true);
if (overlaySelectionFlags & LockSize)
selection.m_fixedLength = (end - begin);
selection.m_dropShadow = (overlaySelectionFlags & DropShadow);
if (m_selections.isEmpty())
m_firstSelectionOriginalBegin = begin;
else if (begin < m_firstSelectionOriginalBegin)
qWarning() << "overlay selections not in order";
m_selections.append(selection);
update();
}