Important: Please read the Qt Code of Conduct -

[SOLVED]Help on QDialog..

  • I have created a dialog window (ui_TestDlg) without any class definition. i mean without (TestDlg.cpp & TestDlg.h) files, just a design form alone.

    And I have only ui_TestDlg.h file . I just want to show this UI form from my MianWindow ( mainwindow.cpp).
    Becoz i am not going to do any operation on this Dialog window.

    I tried several ways to find show() or exec() menthod of this ui_testDlg ...but i am not able to get the same..

    the sample codes are here

    // mainwindow.h
    Ui_TestDlg *ui_tstDlg;

    ui_tstDlg=new Ui_FindComputersDlg;
    ///; ---- this function is not available ...

  • The information you are providing is not sufficient to give any decent comment or advice.

    However, I would suggest that you are using Qt creator to setup the dialog box and try from there.
    Also you could start with the "dialog examples": as an entry point.

  • Of course that function isn't available. An Ui class isn't a QWidget. See here:

  • Moderators

    If you want to just show something, you might consider using QSplashScreen.

    For this dialog, though, try:

    1. Add namespace declaration to mainwindow.h:
      @namespace Ui {
      class Ui_TestDlg;

    2. Initialise the dialog with (new Ui::Ui_TestDlg)

    3. Call ui_tstDlg.setupUi(QObject *parent).

    Might work, although it's just a quick thought and I may have missed something important.

  • Its working now..after made the necessary changes... thanks Peppe

    QDialog *dlg = new QDialog;
    Ui::TestDlg ui;

Log in to reply