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. how to open several ui from a main menu
Forum Updated to NodeBB v4.3 + New Features

how to open several ui from a main menu

Scheduled Pinned Locked Moved Unsolved General and Desktop
14 Posts 5 Posters 2.4k Views 2 Watching
  • 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
    mrjj
    Lifetime Qt Champion
    wrote on 20 Mar 2018, 19:04 last edited by mrjj
    #2

    Hi
    Something like

    put in .h file inside the class definition
    siguiente *prueba=NULL;
    
    then in 
    void ShowTheWindow() {
    if (prueba == NULL ) // only create ONCE
          prueba=new siguiente();
    
    prueba->showFullScreen();
    }
    
    then also have a function to hide it
    void HideTheWindow() {
    if (prueba == NULL ) return; // not created
    prueba->hide();
    or showNormal or what you need
    }
    
    S P 2 Replies Last reply 20 Mar 2018, 21:03
    1
    • M mrjj
      20 Mar 2018, 19:04

      Hi
      Something like

      put in .h file inside the class definition
      siguiente *prueba=NULL;
      
      then in 
      void ShowTheWindow() {
      if (prueba == NULL ) // only create ONCE
            prueba=new siguiente();
      
      prueba->showFullScreen();
      }
      
      then also have a function to hide it
      void HideTheWindow() {
      if (prueba == NULL ) return; // not created
      prueba->hide();
      or showNormal or what you need
      }
      
      S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Mar 2018, 21:03 last edited by
      #3

      Hi,
      Just a small addition to what @mrjj wrote:

      @mrjj said in how to open several ui from a main menu:

      put in .h file
      siguiente *prueba=NULL;

      That should be a member variable of your class.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M mrjj
        20 Mar 2018, 19:04

        Hi
        Something like

        put in .h file inside the class definition
        siguiente *prueba=NULL;
        
        then in 
        void ShowTheWindow() {
        if (prueba == NULL ) // only create ONCE
              prueba=new siguiente();
        
        prueba->showFullScreen();
        }
        
        then also have a function to hide it
        void HideTheWindow() {
        if (prueba == NULL ) return; // not created
        prueba->hide();
        or showNormal or what you need
        }
        
        P Offline
        P Offline
        Paulo G
        wrote on 22 Mar 2018, 08:29 last edited by
        #4

        put in .h file inside the class definition
        siguiente *prueba=NULL;

        in mainWindows.h

        error de compilation

        J 1 Reply Last reply 22 Mar 2018, 08:41
        0
        • P Paulo G
          22 Mar 2018, 08:29

          put in .h file inside the class definition
          siguiente *prueba=NULL;

          in mainWindows.h

          error de compilation

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 22 Mar 2018, 08:41 last edited by
          #5

          @Paulo-G It would help if you would tell us what error you get...
          And can you show the header file so we can see where you added that line?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • P Offline
            P Offline
            Paulo G
            wrote on 23 Mar 2018, 09:24 last edited by
            #6
            This post is deleted!
            1 Reply Last reply
            0
            • P Offline
              P Offline
              Paulo G
              wrote on 23 Mar 2018, 09:47 last edited by
              #7

              0_1521797213903_error.jpg
              mainwindow.h:30: error: 'siguiente' does not name a type
              siguiente *vRoll=NULL;

              J 1 Reply Last reply 23 Mar 2018, 10:04
              0
              • P Paulo G
                23 Mar 2018, 09:47

                0_1521797213903_error.jpg
                mainwindow.h:30: error: 'siguiente' does not name a type
                siguiente *vRoll=NULL;

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 23 Mar 2018, 10:04 last edited by
                #8

                @Paulo-G said in how to open several ui from a main menu:

                mainwindow.h:30: error: 'siguiente' does not name a type

                include the header file where siguiente is declared. Or if it is already the case is this siguiente in a namespace?
                Maybe

                Ui::siguiente vRoll = NULL;
                

                ?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                2
                • P Offline
                  P Offline
                  Paulo G
                  wrote on 23 Mar 2018, 15:38 last edited by
                  #9
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    Paulo G
                    wrote on 23 Mar 2018, 15:43 last edited by
                    #10

                    En mainwindows.h
                    public:
                    Ui:: siguiente *vRoll=NULL;

                    En mainwindows.cpp

                    if (vRoll=NULL)
                    vRoll=new siguiente();
                    vRoll->show();

                    ----error
                    cannnot convert 'siguiente*' to Ui::siguiente*'
                    class Ui::siguiente has no member name show

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 23 Mar 2018, 16:19 last edited by
                      #11

                      Hi
                      siguiente seems to be a dialog so not very likely its inside
                      UI::
                      You did have
                      #include "siguiente.h" in top of the mainwindow.h ?

                      P 1 Reply Last reply 26 Mar 2018, 10:48
                      0
                      • M mrjj
                        23 Mar 2018, 16:19

                        Hi
                        siguiente seems to be a dialog so not very likely its inside
                        UI::
                        You did have
                        #include "siguiente.h" in top of the mainwindow.h ?

                        P Offline
                        P Offline
                        Paulo G
                        wrote on 26 Mar 2018, 10:48 last edited by
                        #12

                        I had already added headers

                        #include "siguiente.h"

                        M J 2 Replies Last reply 26 Mar 2018, 10:54
                        0
                        • P Paulo G
                          26 Mar 2018, 10:48

                          I had already added headers

                          #include "siguiente.h"

                          M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 26 Mar 2018, 10:54 last edited by
                          #13

                          @Paulo-G
                          If so - it should accept
                          siguiente *vRoll = NULL;
                          if it still complains, try
                          siguiente *vRoll;
                          ( and set it to null in constructor)

                          1 Reply Last reply
                          0
                          • P Paulo G
                            26 Mar 2018, 10:48

                            I had already added headers

                            #include "siguiente.h"

                            J Online
                            J Online
                            J.Hilk
                            Moderators
                            wrote on 26 Mar 2018, 10:56 last edited by J.Hilk
                            #14

                            @Paulo-G
                            I doubt that, in the screenshot you posted, the line after

                            #include "siguiente.h
                            is clearly
                            #include "ui_siguiente.h

                            that let's me to believe, that you placed #include "siguiente.h inside siguiente.h or siguiente.cpp


                            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                            Q: What's that?
                            A: It's blue light.
                            Q: What does it do?
                            A: It turns blue.

                            1 Reply Last reply
                            1

                            11/14

                            23 Mar 2018, 16:19

                            • Login

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