• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ selectionEnd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: owner

bool TextCursor::isSame(Cursor* c)
{
	auto tc = dynamic_cast<TextCursor*>(c);
	if (tc)
		return tc->owner() == owner()
				&& tc->selectionBegin() == selectionBegin()
				&& tc->selectionEnd() == selectionEnd();

	return false;
}
开发者ID:Andresbu,项目名称:Envision,代码行数:10,代码来源:TextCursor.cpp


示例2: data

QString ChatItem::selection() const
{
    if (selectionMode() == FullSelection)
        return data(MessageModel::DisplayRole).toString();
    if (selectionMode() == PartialSelection) {
        int start = qMin(selectionStart(), selectionEnd());
        int end   = start + qAbs(selectionStart() - selectionEnd());

        QTextCursor cSelect(document());
        cSelect.setPosition(start);
        cSelect.setPosition(end, QTextCursor::KeepAnchor);
        return cSelect.selectedText();
    }
    return QString();
}
开发者ID:arneboe,项目名称:ProjectTox-Qt-GUI,代码行数:15,代码来源:chatitem.cpp


示例3: document

QAbstractTextDocumentLayout::Selection ChatItem::selectionLayout() const
{
        QAbstractTextDocumentLayout::Selection selection;

        if (!hasSelection())
            return selection;

        int start;
        int end;

        if (selectionMode() == FullSelection) {
            start = 0;
            end = document()->characterCount()-1;
        }
        else {
            start = selectionStart();
            end   = selectionEnd();
        }

        QTextCursor c(document());
        c.setPosition(start);
        c.setPosition(end, QTextCursor::KeepAnchor);
        selection.cursor = c;

        return selection;
}
开发者ID:arneboe,项目名称:ProjectTox-Qt-GUI,代码行数:26,代码来源:chatitem.cpp


示例4: buildCompletionList

void TabCompleter::complete()
{
    if (!enabled) {
        buildCompletionList();
        enabled = true;
    }

    if (nextCompletion != completionMap.end()) {
        // clear previous completion
        auto cur = msgEdit->textCursor();
        cur.setPosition(cur.selectionEnd());
        msgEdit->setTextCursor(cur);
        for (int i = 0; i < lastCompletionLength; ++i)
            msgEdit->textCursor().deletePreviousChar();

        // insert completion
        msgEdit->insertPlainText(*nextCompletion);

        // remember charcount to delete next time and advance to next completion
        lastCompletionLength = nextCompletion->length();
        ++nextCompletion;

        // we're completing the first word of the line
        if (msgEdit->textCursor().position() == lastCompletionLength) {
            msgEdit->insertPlainText(nickSuffix);
            lastCompletionLength += nickSuffix.length();
        }
    } else { // we're at the end of the list -> start over again
        if (!completionMap.isEmpty()) {
            nextCompletion = completionMap.begin();
            complete();
        }
    }
}
开发者ID:Grokafar,项目名称:qTox,代码行数:34,代码来源:tabcompleter.cpp


示例5: value

void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionState& exceptionState)
{
    if (start > end) {
        exceptionState.throwDOMException(IndexSizeError, "The provided start value (" + String::number(start) + ") is larger than the provided end value (" + String::number(end) + ").");
        return;
    }
    if (hasAuthorShadowRoot())
        return;

    String text = innerTextValue();
    unsigned textLength = text.length();
    unsigned replacementLength = replacement.length();
    unsigned newSelectionStart = selectionStart();
    unsigned newSelectionEnd = selectionEnd();

    start = std::min(start, textLength);
    end = std::min(end, textLength);

    if (start < end)
        text.replace(start, end - start, replacement);
    else
        text.insert(replacement, start);

    setInnerTextValue(text);

    // FIXME: What should happen to the value (as in value()) if there's no renderer?
    if (!renderer())
        return;

    subtreeHasChanged();

    if (equalIgnoringCase(selectionMode, "select")) {
        newSelectionStart = start;
        newSelectionEnd = start + replacementLength;
    } else if (equalIgnoringCase(selectionMode, "start"))
        newSelectionStart = newSelectionEnd = start;
    else if (equalIgnoringCase(selectionMode, "end"))
        newSelectionStart = newSelectionEnd = start + replacementLength;
    else {
        // Default is "preserve".
        long delta = replacementLength - (end - start);

        if (newSelectionStart > end)
            newSelectionStart += delta;
        else if (newSelectionStart > start)
            newSelectionStart = start;

        if (newSelectionEnd > end)
            newSelectionEnd += delta;
        else if (newSelectionEnd > start)
            newSelectionEnd = start + replacementLength;
    }

    setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:55,代码来源:HTMLTextFormControlElement.cpp


示例6: innerTextValue

void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigned start, unsigned end, const String& selectionMode, ExceptionCode& ec)
{
    if (start > end) {
        ec = INDEX_SIZE_ERR;
        return;
    }

    String text = innerTextValue();
    unsigned textLength = text.length();
    unsigned replacementLength = replacement.length();
    unsigned newSelectionStart = selectionStart();
    unsigned newSelectionEnd = selectionEnd();

    start = std::min(start, textLength);
    end = std::min(end, textLength);

    if (start < end)
        text.replace(start, end - start, replacement);
    else
        text.insert(replacement, start);

    setInnerTextValue(text);

    // FIXME: What should happen to the value (as in value()) if there's no renderer?
    if (!renderer())
        return;

    subtreeHasChanged();

    if (equalIgnoringCase(selectionMode, "select")) {
        newSelectionStart = start;
        newSelectionEnd = start + replacementLength;
    } else if (equalIgnoringCase(selectionMode, "start"))
        newSelectionStart = newSelectionEnd = start;
    else if (equalIgnoringCase(selectionMode, "end"))
        newSelectionStart = newSelectionEnd = start + replacementLength;
    else {
        // Default is "preserve".
        long delta = replacementLength - (end - start);

        if (newSelectionStart > end)
            newSelectionStart += delta;
        else if (newSelectionStart > start)
            newSelectionStart = start;

        if (newSelectionEnd > end)
            newSelectionEnd += delta;
        else if (newSelectionEnd > start)
            newSelectionEnd = start + replacementLength;
    }

    setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:53,代码来源:HTMLTextFormControlElement.cpp


示例7: fileToDocPos

QTextCursor YFileCursor::qTextCursor(const YTextDocument * document) const
{
    if(isNull()) { return QTextCursor(); }

    int anchor = fileToDocPos(charAddress(), document);
    int position = fileToDocPos(selectionEnd(), document);

    if(position < anchor) { std::swap(position, anchor); }

    QTextCursor cursor(document->begin());
    cursor.setPosition(anchor);
    cursor.setPosition(position, QTextCursor::KeepAnchor);

    return cursor;
}
开发者ID:MrMontag,项目名称:yata,代码行数:15,代码来源:YFileCursor.cpp


示例8: setRangeText

void HTMLTextFormControlElement::setRangeText(const String& replacement, ExceptionCode& ec)
{
    setRangeText(replacement, selectionStart(), selectionEnd(), String(), ec);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:4,代码来源:HTMLTextFormControlElement.cpp


示例9: String

String HTMLTextFormControlElement::selectedText() const
{
    if (!isTextFormControl())
        return String();
    return value().substring(selectionStart(), selectionEnd() - selectionStart());
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:6,代码来源:HTMLTextFormControlElement.cpp


示例10: setSelectionRange

void HTMLTextFormControlElement::setSelectionDirection(const String& direction)
{
    setSelectionRange(selectionStart(), selectionEnd(), direction);
}
开发者ID:awong-chromium,项目名称:webkit,代码行数:4,代码来源:HTMLTextFormControlElement.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ selectionStart函数代码示例发布时间:2022-05-30
下一篇:
C++ selectionChanged函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap