Commit 727cd9e5 authored by Mathieu Westphal's avatar Mathieu Westphal
Browse files

Scrolling to the bottom of the editor when adding incremental trace

This ensure the editor show the last added code when using
incremental trace
parent 4444c571
......@@ -174,6 +174,13 @@ void pqTraceReaction::editTrace(const QString& trace, bool incremental)
Q_ASSERT(this->Editor);
this->Editor->setText(trace);
this->Editor->show();
// Scroll to bottom of the editor when addding content in an incremental trace
if (!new_editor && incremental)
{
this->Editor->scrollToBottom();
}
if (new_editor ||
incremental == false) // don't raise the window if we are just updating the trace.
{
......
......@@ -48,6 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <QMenu>
#include <QMenuBar>
#include <QMessageBox>
#include <QScrollBar>
#include <QStatusBar>
#include <QTextEdit>
#include <QTextStream>
......@@ -380,3 +381,9 @@ QString pqPythonScriptEditor::strippedName(const QString& fullFileName)
{
return QFileInfo(fullFileName).fileName();
}
//-----------------------------------------------------------------------------
void pqPythonScriptEditor::scrollToBottom()
{
this->TextEdit->verticalScrollBar()->setValue(this->TextEdit->verticalScrollBar()->maximum());
}
......@@ -53,6 +53,11 @@ public:
void setSaveDialogDefaultDirectory(const QString& dir);
void setPythonManager(pqPythonManager* manager);
/*
* Scroll the editor to the bottom of the scroll area
*/
void scrollToBottom();
public slots:
void open(const QString& filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment