Basic Help



  • I am pretty new at this but have read all the basic manuals and getting the hang of it. In QT Creator I created a MainWindow application. After the fact I wanted to create a QDialog that I link to a push button. So it created another .ui file and I get the autogenerated ui.h. I understand all the signals and slots but for the life of me I can figure out how to launch the Qdialog box from inside the Mainwindow UI. It recognizes the new class inside the MainWindow, but all I see is all the widgets (buttons, setupUI, etc) in the form, and not show() or exec(). Any help is appreciated.



  • Welcome to net.

    Hope it is as simple as follows.

    QDialog *dialog = new QDialog
    dialog.show() or exec().

    bq. It recognizes the new class inside the MainWindow, but all I see is all the widgets (buttons, setupUI, etc) in the form, and not show() or exec().

    What do you mean by the above statement.

    Some code snippet would help.



  • In your .ui form file, If you click with the right button at the class will show some action you can do and one of then is "go to slot". If you click at this action it will some signal's that you can connect for your slot.

    Still at "Design" there is a "Signals & Slots" editor just at left bottom, you can use it to create the connections to.

    You could also create a connection in you .h,.cpp file. Just create a normal function in you .h file:
    "void createConnection()"
    And at .cpp file you create you connection normally:
    "connect(object1,signal1,object2,slot2)"

    Now If you are trying to run show() or other's slot's function inside "Design" and I think that's not possible. You can only make the connections, to execute than you have to run your application.



  • Thank you that worked. It seems like I can just build it manually like you stated to make it easier.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.