Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt GUI in Visual Studio..New Added Widgets through Qt Designer inaccessible



  • Hello Everyone,

    I wrote an application in Visual Studio and I needed to create a GUI for it so I decided to use Qt and I'm having a small but weird problem.

    Let's say I add a Push button to the GUI in the Qt Designer. When I build the Application the UI Compiler creates the corresponding header file "ui_myApp.h" which has the new Push button.

    When I Try to access the new Button and connect Signals and Slots the I can't find the Button. I only see old Widgets that I added before the Last build. It actually should show me "pushButton_2" and "pushButton_3" but I have only access to the pushButton and other Widgets before the last build.(See Figure)
    1edd5ce5-a688-480e-ac5e-bbe03bfe8cc8-image.png

    I Checked the headerfile "ui_myApp.h" and the new Widgets are actually there. The Header file is correctly included. When I run my Application the new Button and new Widgets are there too. Why can't I access them when Connecting Signals and Slots in "myApp.cpp"??

    Thanks!



  • This may or may not help anyone. But if anyone ever faces the problem here how I solved it:

    Each time I add new Widgets to my GUI using QT Designer I save the changes in the Form. Then I clean the Solution and Rebuild. Then I close Visual Studio and start it again. The new Widgets are accessible after these action. Not sure why.. but it does the job.
    If this doesn't work for you you may want to take a look at this : Inaccessible QPushButton mystery


Log in to reply