Important: Please read the Qt Code of Conduct -

A n00b's question: where is the code?

  • Hello World.

    I have been into my 4th day of reading manuals and watching tutorials on developing with Qt. My I ask a dumb question? I have created a stackedWidget with several panels and buttons on them in Qt Creator (C++, MinGW). Now, I go to Edit to edit my code in the main.cpp and find that none of the objects are there. Aren't the widgets supposed to appear in main.cpp file after they have been created (since you can create them by writing a code directly in main.cpp)?

    Sorry for a silly question but I am confused...


    Edit: So, as far as I can see, the widget codes are in mainwindow.ui... Should it be either main.cpp or ui?

  • Generated .cpp and .h file are hidden by Qt Creator. You can access the widgets in the mainwindow.cpp by using "ui->[nameOfWidget]".

    If you want to see the generated files, they can be found in your source directory.
    Caution: They were not meant to be edited since they change every time you modify the .ui file.

  • I see. Thanks a lot!

    Back to exploring... ))

Log in to reply