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]calling a dialog in another dialog
Forum Update on Monday, May 27th 2025

[solved]calling a dialog in another dialog

Scheduled Pinned Locked Moved General and Desktop
25 Posts 5 Posters 13.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.
  • R Offline
    R Offline
    rh
    wrote on 9 Jul 2011, 07:27 last edited by
    #1

    hi everybody
    i'm new in qt programming.
    in my program there are 2 dialogs.
    one of them is main dialog with a pushbotton in it.
    i want that when i push the botton in the main dialog ,second dialog opens.
    i add
    @
    #include "seconddialogname.h"
    & add
    secondDialog *var-name;
    var-name->show();
    @
    to the fmainDialog.cpp file

    but it doesn't work!
    i got an (no such file or directory)error about including the second dialog in the maindialog
    can anyone help me please?
    i searches about it a lot,but i didn't fine any usefull result!!!!!
    thank u

    Edit: please use @ tags around code sections; Andre

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rh
      wrote on 9 Jul 2011, 07:41 last edited by
      #2

      if anyone know the answer please help me.
      i'm in hurry & i should write my program till tommorow.
      thank u.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rh
        wrote on 9 Jul 2011, 08:09 last edited by
        #3

        this is my code
        @
        #include "dialog.h"
        #include "ui_dialog.h"
        #include "signup.h"

        void Dialog::on_cmdSignup_clicked()
        {
        // Signup *mySignup=new Signup;
        mySignup->show();
        }

        @

        *and these are the errors *
        @
        dialog.cpp:3:20: error: signup.h: No such file or directory
        dialog.cpp: In member function 'void Dialog::on_cmdSignup_clicked()':
        dialog.cpp:58: error: 'Signup' was not declared in this scope
        dialog.cpp:58: error: expected ';' before 's'
        dialog.cpp:59: error: 's' was not declared in this scope
        @

        1 Reply Last reply
        0
        • C Offline
          C Offline
          changsheng230
          wrote on 9 Jul 2011, 08:20 last edited by
          #4

          Please refer to the Qt example: $QTDIR\Examples\4.7\dialogs\standarddialogs

          Chang Sheng
          常升

          1 Reply Last reply
          0
          • D Offline
            D Offline
            DenisKormalev
            wrote on 9 Jul 2011, 08:31 last edited by
            #5

            r@h@, please don't open new threads with same problem. I've already removed duplicate one, please don't create new.

            1 Reply Last reply
            0
            • R Offline
              R Offline
              rh
              wrote on 9 Jul 2011, 08:43 last edited by
              #6

              ok Denis.
              but i've stuck wuth that problem .
              that's y............. :(

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on 9 Jul 2011, 08:52 last edited by
                #7

                Solve the problem step by step. Line 1 of your error messages is not that hard to interpret, is it?

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  rh
                  wrote on 9 Jul 2011, 08:59 last edited by
                  #8

                  thank u to reply Andre.
                  ok.
                  well i think this is the main problem .
                  coz if signup.h be known in dialog.cpp ,i think other errors should be disappear.
                  am i right?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on 9 Jul 2011, 09:09 last edited by
                    #9

                    Try and see...

                    On a side note: please try to write proper English. By that I don't mean that you can not make mistakes (we, including yours truly, are not all native speakers after all), but please do take care to avoid MSN L337-speak. That is: write "you", not "u", and "because" instead of "coz" please, and also take care of using proper capitals and punctuation. That would make your messages easier to read, thus enabling readers to focus on your problem, instead of trying to understand what you want to tell us.

                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      rh
                      wrote on 9 Jul 2011, 09:32 last edited by
                      #10

                      okay.
                      my english is not so good.okay.
                      sorry if i made mistake.
                      "signup" and "dialog" are the names of two dialogs in my program.
                      "dialog" form has a pushbutton with the name of "signup".
                      i want that when i push this button ,"signup form opens.
                      i include signup.h in dialog.cpp and then use an object from signup class with the name of mySignup ,to open a signup form in on_cmdSignup_clicked() function by pushin signup button.
                      but the problem is that i recieve an error (not such file or directory) about including signup.h.
                      this is the code:
                      @
                      #include "dialog.h"
                      #include "ui_dialog.h"
                      #include "signup.h"

                      void Dialog::on_cmdSignup_clicked()
                      {
                      Signup *mySignup=new Signup;
                      mySignup->exec();

                      }
                      @

                      and these are errors:
                      @
                      dialog.cpp:3:20: error: signup.h: No such file or directory
                      dialog.cpp: In member function 'void Dialog::on_cmdSignup_clicked()':
                      dialog.cpp:56: error: 'Signup' was not declared in this scope
                      dialog.cpp:56: error: 'mySignup' was not declared in this scope
                      dialog.cpp:56: error: expected type-specifier before 'Signup'
                      dialog.cpp:56: error: expected ';' before 'Signup'
                      @

                      thank you to help me.

                      [edit: code highlighted / Denis Kormalev]

                      1 Reply Last reply
                      0
                      • EddyE Offline
                        EddyE Offline
                        Eddy
                        wrote on 9 Jul 2011, 09:40 last edited by
                        #11

                        The error means your program doesn't find the signup.h file.

                        Do you know where it is?

                        Did you put it in your pro file?

                        Qt Certified Specialist
                        www.edalsolutions.be

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          DenisKormalev
                          wrote on 9 Jul 2011, 09:42 last edited by
                          #12

                          r@h@, Andre already asked you to highlight code with @ tags. I'm asking you again. Highlighted code is much easier to read.

                          Do you have this file (sighup.h) in same directory where your dialog.cpp contains? If not do you have needed directory in INCLUDEPATH in your pro file?

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            rh
                            wrote on 9 Jul 2011, 09:54 last edited by
                            #13

                            in fact my question is that why when i use <#include "signup.h" > in dialog.cpp ,i receive an (no such file or directory)error .
                            it's not possible in QT to include a dialog in another dialog?

                            and how can i call a dialog by pushing a button in another dialog?

                            i hope i could explain what's my problem with this program....

                            1 Reply Last reply
                            0
                            • D Offline
                              D Offline
                              DenisKormalev
                              wrote on 9 Jul 2011, 09:55 last edited by
                              #14

                              Can you answer my questions about directory structure. I don't think anybody can help you without this info. Crystal balls are not so strong.

                              1 Reply Last reply
                              0
                              • R Offline
                                R Offline
                                rh
                                wrote on 9 Jul 2011, 10:04 last edited by
                                #15

                                yes,(signup.h) file is in same directory where dioalog.cpp contains.
                                and i add signup.h by
                                (right click on Form directory in the project)->(add new ) -> (Qt Designer Form Class)
                                yes , (signup.h) is in HEADERS in .pro file

                                1 Reply Last reply
                                0
                                • R Offline
                                  R Offline
                                  rh
                                  wrote on 9 Jul 2011, 10:06 last edited by
                                  #16

                                  and about high lighting the code how can i do that?
                                  i don't know it.

                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    DenisKormalev
                                    wrote on 9 Jul 2011, 10:07 last edited by
                                    #17

                                    Are you sure you don't have any typos in filename? If you include existing file from same directory it will work. Can you post here screenshot of directory where your dialog.cpp contains?

                                    P.S. About highlighting. Andre and I already said that you can use @ tags for it.

                                    1 Reply Last reply
                                    0
                                    • R Offline
                                      R Offline
                                      rh
                                      wrote on 9 Jul 2011, 10:21 last edited by
                                      #18

                                      excuse me Denis.
                                      what do you mean by screenshot of directory?
                                      how can i do that?

                                      1 Reply Last reply
                                      0
                                      • R Offline
                                        R Offline
                                        rh
                                        wrote on 9 Jul 2011, 10:43 last edited by
                                        #19

                                        you mean project by directory?
                                        if yes,so (signup.h) is in the same directory where dialog.cpp contains.
                                        actually (signup.h) and (dialog.h) are in th Headers part,
                                        (signup.cpp) and (dialog.cpp) are in the Sources part.
                                        i thought maybe including a dialog in another dialog is not possible in Qt
                                        and that's why i got that error.

                                        1 Reply Last reply
                                        0
                                        • D Offline
                                          D Offline
                                          DenisKormalev
                                          wrote on 9 Jul 2011, 10:44 last edited by
                                          #20

                                          If you use Linux just go in console into your dir, type ls there and copy output here. If you use Windows open your directory in Explorer and make a screenshot of it (or use dir comand in windows console).

                                          1 Reply Last reply
                                          0

                                          1/25

                                          9 Jul 2011, 07:27

                                          • Login

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