Important: Please read the Qt Code of Conduct -


  • How is it possible to connect a widget from the main window to a different widget created with qt designer

  • Hi and welcome to devnet

    Probably you have to give some more details of you like to do. Possibly also some code would be good.

    Basically you have to decide where to make your connect. Then you need to have pointers to the main window and the other widget.
    Alternatively, you may also be able to connect signals and slots directly in designer.

    Did you follow some tutorial and some of the examples?

  • I have two different form: a main windows and a widget. On the main windows I just placed a button and on the widget a line edit and a calender widget. What I want is that when you click on on the button in the main windows, the second form appears. How to connect them using signal and slots

  • Lifetime Qt Champion

    "How to connect them using signal and slots "

    Not sure here what you want to connect. :)

    To show another "form", you can just create an instance - when you need it and
    tell it to be shown.

    There are different ways of showing such form.
    it can be like a dialog and block the other window
    or they can both be active. show() vs exec()

    so to show your other "form"

    Add a variable to MainWin to hold your pointer

    OtherWindow  *Mywin;

    then in the constructor

        Mywin = new OtherWindow ( this );       

    create an instance.
    then to show it

    void MainWin::on_pushButton_clicked()

  • I tried that one but still not working.
    Basically I went to connect two different qmainwindows using a button. The button will be one the first main windows. If the button is pressed the second main windows appear

  • Lifetime Qt Champion

    Hmm, it should work.

    Can you post the code?