MantisBT - ParaView
View Issue Details
0009675ParaViewBugpublic2009-10-07 12:152016-08-12 09:57
Chris Cameron 
Kitware Robot 
normalminoralways
closedmoved 
3.4 
 
0009675: Output window overwrites current selection instead of appending to end of document
When the output window receives new text it typically appends this text to the end of the output window.

However: If a user selects a new cursor position or selects any text in the output window, and THEN new text is added to the output window, this new text will output at the cursor position, and replace the selection if there was one.

The offending code appears to be this, in pqConsoleWidget.cxx

void pqConsoleWidget::printString(const QString& Text)
{
  this->Implementation->textCursor().movePosition(QTextCursor::End);
  this->Implementation->textCursor().insertText(Text);
  this->Implementation->InteractivePosition = this->Implementation->documentEnd();
  this->Implementation->ensureCursorVisible();
}

The problem is that textCursor() returns a COPY of the text cursor, so although the text is still inserted (I think because it has a pointer to the text document), the effects of movePosition(QTextCursor::End) are lost.

I have had success by replacing that code with this:

void pqConsoleWidget::printString(const QString& Text)
{
  this->Implementation->append(Text);
  this->Implementation->InteractivePosition = this->Implementation->documentEnd();
  this->Implementation->ensureCursorVisible();
}

It works because this->Implementation is a QTextEdit, and QTextEdit has an append method which does what was intended by the former code block.

Alternatively, I guess you could make a local variable of textCursor(), then call this->Implementation->setTextCursor() as well.
No tags attached.
Issue History
2009-10-07 12:15Chris CameronNew Issue
2016-08-12 09:57Kitware RobotNote Added: 0037727
2016-08-12 09:57Kitware RobotStatusexpired => closed
2016-08-12 09:57Kitware RobotResolutionopen => moved
2016-08-12 09:57Kitware RobotAssigned To => Kitware Robot

Notes
(0037727)
Kitware Robot   
2016-08-12 09:57   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current ParaView Issues page linked in the banner at the top of this page.