Important: Please read the Qt Code of Conduct -

[SOLVED] QTextEdit not appending from within timer slot.

  • Very strange ... i have a text edit box and , in my timer slot , i try to enter text into the box :
    textBox->append("my text") . But nothing happens . Any ideas ?

    I must be missing something really easy but I am just not seeing it .

    The text box works fine from the class constructor but not within the timer slot .
    I am pretty sure I have updated the gui from a timer slot before so ... or is it not possible ?

  • Hi great88.
    Did you check, is your timer works?
    Put some debug message in body of your timer slot:
    @qDebug()<<"timer slot";@

    if timer not works recheck your code or show us so we can say something.

  • The timer works . The slot runs on timeout . For some reason nothing happens on textBox->append(“my text”) . All other code in the slot runs but nothing is appended to the text box .

  • Try "Clean all" , "Run qmake", "Rebuild all".
    If not helps can you post your code or minimal compilable project?

  • Looks like it has to do with where I initialized my text box . I was initializing it inside the resize event of the window .

    I moved the initialization ( textBox = new QTextEdit(this); ) to the constructor and now textBox->append(“my text”) in the timer slot works .

Log in to reply