I have developed an application in Qt with QMainWindow as a main Widget, and added Mdiarea I needed for adding QMdieSubWindows.
I want know how to have a logging area like in Qt Creator.
My log text is basically what is going on. As
Started the optimizer ... File is saved ... The file is not loaded ... and etc.
I thought of adding a QPlainTextEdit
or a QTextEdit
, and just append text to them.
I wrote this in my QMainWindow.cpp:
QPlainText* mydebugger = new QPlainText(this);
mydebugger.appendPlaintext("Debugger started");
mydebugger.show();
But this is showing the plainText over my Menu in QMainWindow;
I would like to have it on the bottom, above my StatusBar.
I would like to ask now:
QPlainTextEdit
or QTextEdit
: which one is better for my task? I need only appending the text, and maybe highlighting, and coloring the text.
How to get the Q(Plain)TextEdit
as for example in QtCreator at the bottom with fixed position and fixed width?
I tried to create an MdiSubWindow and add the plaintext widget into it, and show it. It works as I wanted, and I can add text in it. But I can not still make fixed at the bottom. Any ideas?
If you want colour and other formatting options, QTextEdit
is your way to go. QPlainTextEdit
does not allow formatting.
You're better off using a QDockWidget
than a QMdiSubWindow
. You can then dock your logger at the bottom of your main window.