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

C++ ensureCursorVisible函数代码示例

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

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



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

示例1: QPlainTextEdit

CodeEditor::CodeEditor(Config* config, QWidget* parent)
    : QPlainTextEdit(parent), config(config)
{
    highlighter = new Highlighter(config, this); // тормоз

    extraArea = new QWidget(this);
    extraArea->setCursor(Qt::PointingHandCursor);
    extraArea->setAutoFillBackground(true);
    extraArea->installEventFilter(this);

    completer = new QCompleter(config->keywordsSorted, this);
    completer->setWidget(this);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setWrapAround(false);

    setLineWrapMode(QPlainTextEdit::NoWrap);
    setCursorWidth(2);
    blockCountChanged(0);
    setMouseTracking(true);

    reconfig();

    // не допускаем проваливание на последнем свернутом блоке
    connect(this,       SIGNAL(cursorPositionChanged()),       SLOT(ensureCursorVisible()));
    connect(this,       SIGNAL(blockCountChanged(int)),        SLOT(blockCountChanged(int)));
    connect(document(), SIGNAL(contentsChange(int, int, int)), SLOT(contentsChange(int, int, int)));
    connect(completer,  SIGNAL(activated(const QString&)),     SLOT(insertCompletion(const QString&)));
    connect(config,     SIGNAL(reread(int)),                   SLOT(reconfig(int)));
    connect(this,       SIGNAL(updateRequest(QRect, int)), extraArea, SLOT(update()));
}
开发者ID:MichaelJE,项目名称:Clips,代码行数:30,代码来源:codeeditor.cpp


示例2: insertPlainText

// Result received
void Console::result(QString result) {
  insertPlainText(result);
  insertPlainText("\n");
  insertPlainText(userPrompt);
  ensureCursorVisible();
  locked = false;
}
开发者ID:gitter-badger,项目名称:AlphaPlot,代码行数:8,代码来源:Console.cpp


示例3: escapePressed

void FocusedTextEdit::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_Escape) {
        emit escapePressed();
        return;
    }

    if (m_disableUpdatesOnKeyPress)
        setUpdatesEnabled(false);

    KTextEdit::keyPressEvent(event);

    // Workaround (for ensuring the cursor to be visible): signal not emitted when pressing those keys:
    if (event->key() == Qt::Key_Home
            || event->key() == Qt::Key_End
            || event->key() == Qt::Key_PageUp
            || event->key() == Qt::Key_PageDown)
        emit cursorPositionChanged();


    if (m_disableUpdatesOnKeyPress) {
        setUpdatesEnabled(true);
        if (!document()->isEmpty())
            ensureCursorVisible();
    }
}
开发者ID:AlD,项目名称:basket,代码行数:26,代码来源:focusedwidgets.cpp


示例4: textCursor

void TabTerminal::_insertPrompt()
{
	QTextCursor cursor = textCursor();
	cursor.insertBlock();
	insertHtml(_userPrompt);
	ensureCursorVisible();
}
开发者ID:puzzleSEQ,项目名称:client,代码行数:7,代码来源:tabTerminal.cpp


示例5: appendPlainText

void tekOutput::printDate()
{
	QDateTime tmdt = QDateTime::currentDateTime();
	appendPlainText(tr("Date:") + getDate(tmdt) + tr("\n") +
					tr("Time: ")+ getTime(tmdt) + tr("\n"));
	ensureCursorVisible();
}
开发者ID:frostoov,项目名称:tekControl,代码行数:7,代码来源:tekoutput.cpp


示例6: QTextCursor

void Console::write(QString text) {
    QTextCursor* cursor = new QTextCursor(document());
    cursor->movePosition(QTextCursor::End);
    cursor->insertText(text);

    ensureCursorVisible();
}
开发者ID:IanFinlayson,项目名称:tetra,代码行数:7,代码来源:console.cpp


示例7: textCursor

/** \brief Anhängen einer Zeile ans Ende.

  Am Ende der Ausgabe wird immer ein Newline + Prompt ausgegeben!
*/
void QCommandPrompt::write(QString sMsg, QColor /*col*/)
{
    // Überprüfen, ob die Zeile mit einem Prompt anfängt
    QTextCursor tc = textCursor();
    tc.movePosition(QTextCursor::StartOfLine);
    tc.select(QTextCursor::LineUnderCursor);
    tc.removeSelectedText();
    setTextCursor(tc);

    // old: simple text
    insertPlainText(sMsg + "\n" + m_sPrompt);
/*
    // colored version
    QBrush brush(Qt::SolidPattern);
    brush.setColor(col);

    QTextCharFormat fmt;
    fmt.setForeground(brush);
    tc.insertText(sMsg + "\n", fmt);

    brush.setColor(m_colDefault);
    fmt.setForeground(brush);
    tc.insertText(m_sPrompt, fmt);
*/
    m_nPromptPos = tc.position();

    ensureCursorVisible();
}
开发者ID:beltoforion,项目名称:InstantLua,代码行数:32,代码来源:QCommandPrompt.cpp


示例8: pauseCursor

void ByteArrayColumnViewPrivate::setActiveCoding( AbstractByteArrayView::CodingTypeId codingId )
{
    // no changes or not visible?
    if( codingId == activeCoding()
        || (codingId == AbstractByteArrayView::ValueCodingId && !mValueColumn->isVisible())
        || (codingId == AbstractByteArrayView::CharCodingId && !mCharColumn->isVisible()) )
        return;

    pauseCursor();
    mValueEditor->finishEdit();

    if( codingId == AbstractByteArrayView::ValueCodingId )
    {
        mActiveColumn = mValueColumn;
        mInactiveColumn = mCharColumn;
    }
    else
    {
        mActiveColumn = mCharColumn;
        mInactiveColumn = mValueColumn;
    }
    adaptController();

    ensureCursorVisible();
    unpauseCursor();
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:26,代码来源:bytearraycolumnview_p.cpp


示例9: activateWindow

void Console::WriteOutput(QString out)
{
    activateWindow();
    moveCursor(QTextCursor::End);
    insertPlainText(out);
    ensureCursorVisible();
}
开发者ID:ghuysmans,项目名称:spim,代码行数:7,代码来源:console.cpp


示例10: clear

void WareSrcMsgViewer::clearMessages()
{
  clear();

  ensureCursorVisible();

  m_MessagesByBlockNumber.clear();
}
开发者ID:OpenFLUID,项目名称:openfluid,代码行数:8,代码来源:WareSrcMsgViewer.cpp


示例11: ansiRx

void ClientTextEdit::displayText(const QString& str) {
  // ANSI codes are formatted as the following:
  // escape + [ + n1 (+ n2) + m
  QRegExp ansiRx("\\0033\\[((?:\\d+;)*\\d+)m");
  QRegExp subBlockRx("\\0010");
  QStringList blocks = str.split(ansiRx);
  QStringList ansi, subAnsi, subBlock;
  int i = 0, j, k;

  ansi << "";
  while ((i = ansiRx.indexIn(str, i)) != -1) {
    ansi << ansiRx.cap(1);
    i += ansiRx.matchedLength();
  }

  for (i = 0; i < blocks.count(); i++) {
    // split several semicoloned ansi codes into individual codes
    subAnsi = ansi[i].split(";"); 
    QStringListIterator ansiIterator(subAnsi);
    while (ansiIterator.hasNext() && i != 0)
      updateFormat(_format, ansiIterator.next().toInt());

    // split the text into sub-blocks
    blocks[i].replace((char)20, " "); // replace hex-spaces with normal spaces

    if ((k = blocks[i].indexOf(subBlockRx)) != -1) {
      j = 0;
      do {
        //qDebug("j%d k%d %s", j, k, blocks[i].toAscii().data());
        if (blocks[i].length() > 2) { // this is for the "You begin to search.." etc lines
          _cursor.insertText(blocks[i].mid(j, k), _format);
          moveCursor(-1);
        } else {                     // HACK because the twiddler has a backspace following the twiddler character
          moveCursor(-1);
          _cursor.insertText(blocks[i].mid(j, k), _format);
        }
        j = k + 1;
      } while ((k = blocks[i].indexOf(subBlockRx, j)) != -1);
      _cursor.insertText(blocks[i].mid(j), _format);
    } else _cursor.insertText(blocks[i], _format);

    /*
    for (j = 0; (j = subBlockRx.indexIn(blocks[i], j)) != -1; j += subBlockRx.matchedLength()) {
    qDebug("%s", subBlock.join(",").toAscii().data());
      if (subBlockRx.cap(1).contains(QRegExp("\\0010"))) {
        _cursor.insertText(blockIterator.next(), _format);
        moveCursor(-1);
      }
      else {
        _cursor.insertText(blockIterator.next(), _format);
      }
    }
    */
  }
  setTextCursor(_cursor);
  ensureCursorVisible();

}
开发者ID:alex-games,项目名称:a1,代码行数:58,代码来源:ClientTextEdit.cpp


示例12: setTextCursor

void HaiQTextEdit::goto_marker(QString id) {
	if (!marker_blocks.contains(id)) return;
	QTextBlock block=marker_blocks[id];
	defaultedit_blockdata *block_data=(defaultedit_blockdata *)block.userData();
	if (block_data) {
		setTextCursor(QTextCursor(block));
		ensureCursorVisible();
	}
}
开发者ID:magland,项目名称:sequencetree5,代码行数:9,代码来源:haiqtextedit.cpp


示例13: ACE_DEBUG

void
chat::_cond_scroll() {
    if (_allow_scroll) {
        ACE_DEBUG((LM_DEBUG, "chat::_cond_scroll: scrolling to visible\n"));
        ensureCursorVisible();
    } else {
        ACE_DEBUG((LM_DEBUG, "chat::_cond_scroll: not scrolling to visible\n"));
        verticalScrollBar()->setValue(_saved_pre_insert_vertical_value);
    }
}
开发者ID:ajalkane,项目名称:rvhouse,代码行数:10,代码来源:chat.cpp


示例14: textCursor

void TextEditor::focusPC() {
   if (m_program->getStatus() == PAUSED && m_pc != NULL) {
      QTextBlock *b = m_pc->getTextBlock();
      
      QTextCursor c = textCursor();
      c.setPosition(b->position());
      setTextCursor(c);
      ensureCursorVisible();
   }
}
开发者ID:endrift,项目名称:mipscope,代码行数:10,代码来源:TextEditor.cpp


示例15: setTextCursor

void CodeEditor::gotoLine( int line ){

    QTextBlock block=document()->findBlockByNumber( line );

    setTextCursor( QTextCursor( block ) );

//    verticalScrollBar()->setValue( line );

    ensureCursorVisible();
}
开发者ID:bruZard,项目名称:amigamonkey,代码行数:10,代码来源:codeeditor.cpp


示例16: switch

bool EditWidget::OnKeyDown(int key, int mod)
{
	switch (key) {
	case SDLK_RETURN:
	case SDLK_KP_ENTER:
		parent->ChildNotify(this, EDIT_ENTER);
		break;
	case SDLK_ESCAPE:
		parent->ChildNotify(this, EDIT_ESCAPE);
		break;
	case SDLK_BACKSPACE:
		if (cursor > 0) {
			text.erase(--cursor, 1);
			FORGET_OBJECT(cached_text);
			ensureCursorVisible();
		}
		break;
	case SDLK_DELETE:
		if (cursor != text.size()) {
			text.erase(cursor, 1);
			FORGET_OBJECT(cached_text);
		}
		break;
	case SDLK_LEFT:
		if (cursor > 0) {
			cursor--;
			FORGET_OBJECT(cached_text);
			ensureCursorVisible();
		}
		break;
	case SDLK_RIGHT:
		if (cursor < text.size()) {
			cursor++;
			FORGET_OBJECT(cached_text);
			ensureCursorVisible();
		}
		break;
	default:
		break;
	}

	return true;
}
开发者ID:amichaelt,项目名称:pentagram,代码行数:43,代码来源:EditWidget.cpp


示例17: re

void BaseEditor::findFirstOccurrance(const QString &text, QTextDocument::FindFlags qff,
                                     bool isRE, bool init, bool isSetTextCusor)
{
    if (!finded)
        return;
    QRegExp re(text);
    QTextDocument *doc = document();
    QTextCursor currentCursor = textCursor();
    QTextCursor firstCursor;
    QTextEdit::ExtraSelection es;
    if(!init || prevFindCursor.isNull())
    {
        QTextCursor startCursor;
        if(qff&QTextDocument::FindBackward && !prevFindCursor.isNull())
        {
            prevFindCursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor,
                      abs(prevFindCursor.selectionStart()-prevFindCursor.selectionEnd()));
        }
        if(prevFindCursor.isNull())
            startCursor = currentCursor;
        else
            startCursor = prevFindCursor;
        firstCursor = isRE ? doc->find(re, startCursor, qff):
                             doc->find(text, startCursor, qff);
    } else {
        firstCursor = isRE ? doc->find(re, prevFindCursor.selectionStart(), qff):
                             doc->find(text, prevFindCursor.selectionStart(), qff);
    }
    if(firstCursor.isNull())
    {
        QTextCursor wholeCursor(doc);
        if(qff & QTextDocument::FindBackward)
            wholeCursor.movePosition(QTextCursor::End);
        firstCursor = isRE ? doc->find(re, wholeCursor, qff):
                             doc->find(text, wholeCursor, qff);
    }
    if(firstCursor.isNull())
    {
        prevFindCursor = firstCursor;
        return;
    }
    es.cursor = firstCursor;
    QTextCharFormat f;
    f.setBackground(Qt::blue);
    f.setForeground(Qt::white);
    es.format = f;
    currentFindSelection.clear();
    currentFindSelection.append(es);
    prevFindCursor = firstCursor;
    firstCursor.clearSelection();
    if(isSetTextCusor)
        setTextCursor(firstCursor);
    ensureCursorVisible();
    updateExtraSelection();
}
开发者ID:3rdpaw,项目名称:MdCharm,代码行数:55,代码来源:baseeditor.cpp


示例18: document

void QSAEditor::doRecalc()
{
    document()->invalidate();
    Q3TextParagraph *p = document()->firstParagraph();
    while ( p ) {
	p->format();
	p = p->next();
    }
    ensureCursorVisible();
    repaintContents( false );
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:11,代码来源:qsaeditor.cpp


示例19: placeCursor

/** Reimplementation to insert the text of a dragged reference into the edit view. */
void CPlainWriteDisplay::contentsDragMoveEvent( QDragMoveEvent* e ) {
	if (CDragDropMgr::canDecode(e)) {
		placeCursor(e->pos());
		ensureCursorVisible();
		e->accept(true);
	}
	else {
		e->accept(false);
		e->ignore();
	}
}
开发者ID:bibletime,项目名称:historic-bibletime,代码行数:12,代码来源:cplainwritedisplay.cpp


示例20: QPlainTextEdit

Console::Console(MainWindow* parent)
    : QPlainTextEdit(parent) {
    setContentsMargins(50, 50, 50, 50);

    ensureCursorVisible();
    setCenterOnScroll(false);
    setReadOnly(true);
    this->parent = parent;

    /* update all settings for the console */
    updateSettings();
}
开发者ID:IanFinlayson,项目名称:tetra,代码行数:12,代码来源:console.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ensureGlContext函数代码示例发布时间:2022-05-30
下一篇:
C++ ensure函数代码示例发布时间: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