本文整理汇总了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()));
}
示例2: insertPlainText
// Result received
void Console::result(QString result) {
insertPlainText(result);
insertPlainText("\n");
insertPlainText(userPrompt);
ensureCursorVisible();
locked = false;
}
示例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();
}
}
示例4: textCursor
void TabTerminal::_insertPrompt()
{
QTextCursor cursor = textCursor();
cursor.insertBlock();
insertHtml(_userPrompt);
ensureCursorVisible();
}
示例5: appendPlainText
void tekOutput::printDate()
{
QDateTime tmdt = QDateTime::currentDateTime();
appendPlainText(tr("Date:") + getDate(tmdt) + tr("\n") +
tr("Time: ")+ getTime(tmdt) + tr("\n"));
ensureCursorVisible();
}
示例6: QTextCursor
void Console::write(QString text) {
QTextCursor* cursor = new QTextCursor(document());
cursor->movePosition(QTextCursor::End);
cursor->insertText(text);
ensureCursorVisible();
}
示例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();
}
示例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();
}
示例9: activateWindow
void Console::WriteOutput(QString out)
{
activateWindow();
moveCursor(QTextCursor::End);
insertPlainText(out);
ensureCursorVisible();
}
示例10: clear
void WareSrcMsgViewer::clearMessages()
{
clear();
ensureCursorVisible();
m_MessagesByBlockNumber.clear();
}
示例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();
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
示例15: setTextCursor
void CodeEditor::gotoLine( int line ){
QTextBlock block=document()->findBlockByNumber( line );
setTextCursor( QTextCursor( block ) );
// verticalScrollBar()->setValue( line );
ensureCursorVisible();
}