How to connect one ui withe the other.



  • Here is my Textpad project link. I have two ui files. Now I want to connect signal emitted by action of one ui to the slot that displays the other ui. I want "Help>>About Textpad" in my project to display the dialog.ui. How can I achieve this. I am pretty new to QT.

    "Download my project from here.":https://skydrive.live.com/redir?resid=BBF9030540A807A5!803&authkey=!ACrO9NDLy0F4zWY



  • Haven't looked at your code, but you can do sth like this:
    Make a slot for opening the dialog.
    @
    private slots:
    void showDialog() {
    Dialog *dialog = new Dialog;
    dialog.show();
    }
    @

    And a connection between the action and the slot.

    @
    connect(yourAction,SIGNAL(triggered()),this,SLOT(showDialog()));
    @



  • Hi Vikramjeet!
    First of all add
    @#include "dialog.h"@
    to mainwindow.cpp
    then as wrote panosk, in about() slot body put following code:
    @void MainWindow::about()
    {
    Dialog *dlg = new Dialog(this);
    dlg->exec();
    }@


Log in to reply
 

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