Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]Help on QDialog..
QtWS25 Last Chance

[SOLVED]Help on QDialog..

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 2.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    M_31
    wrote on last edited by
    #1

    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;

    //mainwindow.cpp
    ui_tstDlg=new Ui_FindComputersDlg;
    ///ui_tstDlg.show(); ---- this function is not available ...
    @

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      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":http://doc.qt.nokia.com/4.7/examples-dialogs.html as an entry point.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

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

        http://doc.trolltech.com/latest/designer-using-a-ui-file.html

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          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.

          (Z(:^

          1 Reply Last reply
          0
          • M Offline
            M Offline
            M_31
            wrote on last edited by
            #5

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

            @
            //mainwindow.cpp
            QDialog *dlg = new QDialog;
            Ui::TestDlg ui;
            ui.setupUi(dlg);
            dlg->show();
            @

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved