⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

UI and other classes

  • In my mainwindow class, I have:

    displayed is the string I'm drawing. I have another class, and in that other class I check if the string is valid, and if not,

    Where main is an instance of the MainWindow.

    Using qDebug, it is called fine, and in invalidString() I do:
    displayed = "Error: Invalid string";
    I then do
    qDebug() << displayed;

    It prints Error: Invalid string, as expected.

    However, it continues to draw the previous text, and if I do qDebug displayed in a private slot, it still says the previous text.

    Can anyone help me?

  • Hi,

    It will be really helpful if you can provide some lines of your code, as it we are not able to figure out the main problem related to your code. Also, check in the paintEvent() function whether the QString displayed is still set to the previous text even after main.invalidString() is called. After changing the text value of displayed u can call repaint() function if required.

Log in to reply