Unsolved how to open several ui from a main menu
-
I was doing a graphical interface with a side menu that agreed to press one or the other or different.
The program opens my windows perfectly. And every window the first time I enter works correctly, however, the second time I enter, nothing works.
I suspect it is because an object is created ui every time I enter the window.
The each button where I want the window to open I use this code.close(); siguiente *prueba=new siguiente(); prueba->showFullScreen();
There is a possible solution for this.
Greetings and thanks forward -
Hi
Something likeput 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 }
-
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.
-
put in .h file inside the class definition
siguiente *prueba=NULL;in mainWindows.h
error de compilation
-
@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? -
This post is deleted! -
mainwindow.h:30: error: 'siguiente' does not name a type
siguiente *vRoll=NULL; -
@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?
MaybeUi::siguiente vRoll = NULL;
?
-
This post is deleted! -
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 -
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 ? -
I had already added headers
#include "siguiente.h"
-
@Paulo-G
If so - it should accept
siguiente *vRoll = NULL;
if it still complains, try
siguiente *vRoll;
( and set it to null in constructor) -
@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