Hello.
I am trying to create IO rich-text based console widget using QTextBlock & QTextCursor.
Is it possible to disable breakline character after inserting new QTextBlock?
Hello.
I am trying to create IO rich-text based console widget using QTextBlock & QTextCursor.
Is it possible to disable breakline character after inserting new QTextBlock?
Hmm.... what sense would it make to do that?
I want to append QTextEdit with rich text from userInput, USB or TTY Console
with limited count of displayed characters (only newest data should be visible).
I wondered to insert new block each time device has answered, but it is
inserting new paragraph (with additional break line in document).
My code:
Qt Code:
bool bool_at_bottom = (p_scroll_bar->value() == p_scroll_bar->maximum()); if(addBr) appendText.append("<br>"); .arg(this->_isDevice? this->_deviceColor.name() : this->_commandLineColor.name()) .arg(appendText); this->_containingText.append( appendText ); qDebug() << appendText; appendTextCursor.insertBlock(); appendTextCursor.beginEditBlock(); appendTextCursor.insertHtml(appendText); appendTextCursor.endEditBlock(); if (bool_at_bottom) { p_scroll_bar->setValue(p_scroll_bar->maximum()); }To copy to clipboard, switch view to plain text mode
So don't insert a new block but rather append to the existing one.
Sure, I tried to append previous textBlock, but my widget worked extremely slow.
By adding insertBlock(); widget worked properly, but it appends brs.
Bookmarks