Home > database >  Open a pop up window with a push button QTcreator
Open a pop up window with a push button QTcreator

Time:04-23

i'm actually working on a project. Then, i want to open a pop up window with some other informations when i click on a push button which is on my main window. I work in c with QTcreator but i don't really know how to do that, and i didn't found on web a topic which could help me.

I have started to create an other class for my pop up's containt, and i've written the next method to open it but it doesn't work.

void MainWindow::button_is_pushed()
{
    pop_up_create_analyse* create_device_widget = new pop_up_create_analyse(this);
    create_device_widget->show();
}

CodePudding user response:

Try declaring pop_up_create_analyse* outside of the method.

On your actual code, your pointer will be deleted immediately.

Didn't know what kind of widget is it, but you may also try changing the "show()" to "exec()". Exec() will actually wait for the window to be closed.

  • Related