switched from QTextEdit to QPlainTextEdit for efficiency reasons. Furthermore it allows to limit the block size.

This commit is contained in:
suter_a 2018-07-10 16:22:46 +02:00
parent 0882d2c854
commit 98051779d5
2 changed files with 6 additions and 5 deletions

View File

@ -48,7 +48,8 @@ PFitOutputHandler::PFitOutputHandler(QString workingDirectory, QVector<QString>
// Layout // Layout
fVbox = new QVBoxLayout( this ); fVbox = new QVBoxLayout( this );
//Qt.3x fVbox->resize(800, 500); //Qt.3x fVbox->resize(800, 500);
fOutput = new QTextEdit(); fOutput = new QPlainTextEdit();
fOutput->setMaximumBlockCount(1000);
fVbox->addWidget(fOutput); fVbox->addWidget(fOutput);
fOutput->setMinimumSize(800, 455); fOutput->setMinimumSize(800, 455);
fOutput->setReadOnly(true); fOutput->setReadOnly(true);
@ -125,7 +126,7 @@ void PFitOutputHandler::readFromStdOut()
{ {
// Read and process the data. // Read and process the data.
// Bear in mind that the data might be output in chunks. // Bear in mind that the data might be output in chunks.
fOutput->append( fProc->readAllStandardOutput() ); fOutput->appendPlainText( fProc->readAllStandardOutput() );
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -136,7 +137,7 @@ void PFitOutputHandler::readFromStdErr()
{ {
// Read and process the data. // Read and process the data.
// Bear in mind that the data might be output in chunks. // Bear in mind that the data might be output in chunks.
fOutput->append( fProc->readAllStandardError() ); fOutput->appendPlainText( fProc->readAllStandardError() );
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------

View File

@ -34,7 +34,7 @@
#include <QProcess> #include <QProcess>
#include <QDialog> #include <QDialog>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QTextEdit> #include <QPlainTextEdit>
#include <QPushButton> #include <QPushButton>
#include <QMessageBox> #include <QMessageBox>
#include <QVector> #include <QVector>
@ -66,7 +66,7 @@ private:
QProcess *fProc; ///< pointer to the musrfit process QProcess *fProc; ///< pointer to the musrfit process
QVBoxLayout *fVbox; ///< pointer to the dialog layout manager QVBoxLayout *fVbox; ///< pointer to the dialog layout manager
QTextEdit *fOutput; ///< the captured musrfit output is written (read only) into this text edit object. QPlainTextEdit *fOutput; ///< the captured musrfit output is written (read only) into this text edit object.
QPushButton *fQuitButton; ///< quit button, either to interrupt the fit or to close the dialog at the end of the fit. QPushButton *fQuitButton; ///< quit button, either to interrupt the fit or to close the dialog at the end of the fit.
}; };