qtextbrowser text view problem
-
The problem in your screenshot is that the last row (
setText
) overrides everything done above. just remove that row.how to use the QTextStream
replace
QString output(pl.readAllStandardOutput());
withQTextStream consoleStream(&pl); const QString output = consoleStream.readAll();
-
Hi,
You should add some checks to verify that the process did indeed run and it was successful.
-
The fact that
mediainfo
runs successfully on the command line doesn't mean that it will necessarily run the way you expect it to with QProcess.Are you sure the path to the media file you are using is correct ?
Is it a relative or are an absolute path ?
What if you use the recommended structure of callingQProcess::start
with the command as first parameter and a QStringList with the options as second parameter ?
Did you actually checked thatp1
starts successfully ?
Did you actually checked thatp1
ends successfully ? -
Hi
As for other solution.
Use a QplainTextEdit
and just sets its font to monospaced
ui->plainTextEdit->setFont( (QFontDatabase::systemFont(QFontDatabase::FixedFont)) ); -
@VRonin
Yep something like that - as your code and test file just works
with output from same command on linux.Also, i noticed one thing in code shown on GITHUB
QTextCursor textBrowCrsr(ui->tdetail->document()); const int oldPos = textBrowCrsr.position(); textBrowCrsr.movePosition(QTextCursor::End); QTextCharFormat textBrowFormat = textBrowCrsr.charFormat(); textBrowFormat.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); textBrowCrsr.insertText(output,textBrowFormat); textBrowCrsr.setPosition(oldPos); ui->tdetail->setText(output.toUtf8()); <<<<<<<<<<<<<<<<<< wont that override insertText ?
-
@saber
ok.
I did make small test on linux and VRonin sample did in fact make
it uses fixed font so it looked correctly.
However, using plainTextEdit is a one liner so might be more optimal if you do not need the HTML textbrowse offer