1

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:

  1. QPlainTextEdit or QTextEdit: which one is better for my task? I need only appending the text, and maybe highlighting, and coloring the text.

  2. 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?

4

1 回答 1

2
  1. 如果您想要颜色和其他格式选项,QTextEdit这是您的选择。QPlainTextEdit不允许格式化。

  2. 你最好使用 aQDockWidget比 a QMdiSubWindow。然后,您可以将记录器停靠在主窗口的底部。

于 2014-06-20T16:10:21.290 回答