Important: Please read the Qt Code of Conduct -

ui_mainwindow.h does not update when adding something to the MainWindow

  • Hello, I'm new to Qt and I wanted to try to build something on my own but i noticed that whenever I add something to mainwindow.ui, the file ui_mainwindow.h does not update so when I try to refer to it (ui->label1) it says "No member named 'label1' in Ui::MainWindow.
    (It is named "splashscreen" because I'm trying to make one for an app)
    How do I fix this?
    As I said at the beginning, I'm new and I don't know much about it.

  • @HenkCoder

    Build / Rebuild and qmake after you modify your *.ui files. Then you can access your new stuff.

    QMake is not even necessary but after a rebuild and qmake, everything should be up to date and your QLabel should be accessible from your code.
    Btw: Don't edit the ui_xxx.h file, changes will get overwritten by moc / uic anyway.

  • @Pl45m4
    Thank you very much man, I was looking for a solution for the past two days.
    Thanks again!

Log in to reply