Important: Please read the Qt Code of Conduct -

[Solved] Label on UI Form not changing

  • I have a mainwindow with a Designer UI form. I'm putting quite a few labels on it, but I don't use Designer for all of them. Here's one in particular that I'm placing using C++:
    valve1ClosedLabel = new QLabel(this);
    valve1ClosedLabel->resize(32, 15);
    valve1ClosedLabel->move(656, 98);
    valve1ClosedLabel->setPixmap(QPixmap(":/Pump1KPix/1K RH Valve Closed.png"));
    It showed up on the form, and everything looked great. I then wanted to only show it at certain times, so I put the following line of code after the above lines to make it invisible:
    It didn't disappear. I thought maybe I was using the wrong statement to make it invisible, so I commented out all the code above. I rerun the application, and the label's still there (without it even being defined). I even tried to change the values in the move function, but that has no effect - it's always in the original place. Whenever I rerun the application in Qt Creator, nothing seems to change. What in the world is going on?

  • In such situations you can try removing the build folder. It will make QtCreator to recompile all modules of your project, which fixes some problems.

Log in to reply