Please nominate your Qt Champions for 2021!

QTextEdit doesnt display text

  • Hello,

    I am using the following constructor in a class named LogArea which inherits from QTextEdit.

    @LogArea::LogArea(QWidget* Parent)
    : QTextEdit( Parent)

    Then somewhere else I am placing a LogArea object to a QDockWidget, and then adding the DockWidget to my QMainWindow object.

       @QDockWidget *dock = new QDockWidget(this);     //where this is my QMainWindow object. 

    m_poLogArea = new LogArea(dock);
    addDockWidget (Qt::BottomDockWidgetArea, dock);@

    Then when I run this I can see my QTextEdit widget displayed inside a QDockWidget which I can move and dock at will. my QTextEdit Widget I am not able to append or insert any text. All I see is an empty(as in all blank) QTextEdit widget with no cursor nor text.

    I've checked the signal textChanged of QTextEdit and this signal is emitted when I click my QTextEdit widget and type characters, but still I am not able to see any text on it.

    Also I've changed the text color and font but still no success. And also if I try to this same approach with a different widget like QLabel, all its member functions work like a charm, but I am not able to to the same with QTextEdit for some reason :|

    Any ideas??

    Thanks in advance.

Log in to reply