当前位置: 首页>>代码示例>>C++>>正文


C++ ensureCursorVisible函数代码示例

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


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


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