Yeah its at the beginning of the thread.
Yeah its at the beginning of the thread.
That was meant to address aamer4yu's concerns for me not posting the whole code.
But that code differs from what you posted in #1. So which one is correct, which class is the main window and which is not?
Anyway, your vanishing window problem comes from the already mentioned twice problem that you are allocating the window on the stack that unwinds immediately after the function completes its course.
The code at #6 is meant to launch my SkoolCalcWizard and i wrote it way before i wrote the mainwindow.cpp code, its basically the execution part in main.cpp to confirm that my wizard actually runs. So i posted that to reassure aamer4yu that i needn't post the whole of my SkoolCalcWizard.cpp code here since the wizard's code is tight. It isn't really important in this context.
So the original question is at #1.
I have already told you that code from post #1 is correct apart from compilation issues and a memory leak. The first snippet from #3 is also fine provided that the exec method is a regular QDialog::exec() call.
So what do i do exactly cause thats why am here, that's where i got stuck. I do not know how to resolve the memory leak problem??
Unless you post some minimal example reproducing the problem, we can't help you as the code you initially posted is not the source of the problem. If that's your actual code of course and not something that only resembles your code.
If what i posted isn't the problem then what is? Because i don't really know how to go about anymore.
Like i said my wizard works fine, it launches yes and thats why i posted the code at #6. I am now looking for a way to launch it from my mainwindow when i click New from my mainwindow's File Menu.
The mainwindow also launches successfully and has all the File menu actions like New, Open, Save, Save As, etc defined but i chose to only post the definition for New implemented in MainWindow::newFile() here cause i thought i could change it to suit my needs.
I also showed how New is connected to newFile() in the function MainWindow::createActions() which i originally posted in the first post.
So i really don't know what you want more, all i'm asking is if there's some alternative way i could change the portions of the code snippets i posted to suit my needs because that's where i am stuck, because there's a memory leak so my method is apparently wrong, isn't there an alternative.
Both the wizard and the mainwindow launch when you run one and then change the code to run the other, in main.cpp so how would you connect the two so that they launch the way i want ??
No idea, we're yet to see some compilable example reproducing the problem.
Code in post #1 does that (once you fix compilation errors).I am now looking for a way to launch it from my mainwindow when i click New from my mainwindow's File Menu.
We want a (1) minimal (i.e. max 50 lines of code), (2) compilable (i.e. creating a launchable executable) example (3) reproducing the problem (i.e. demonstrating what doesn't work).So i really don't know what you want more
What you posted should work fine.all i'm asking is if there's some alternative way i could change the portions of the code snippets i posted
Do you know what a memory leak is and how to fix one?because there's a memory leak
I know what a memory leak is but can't figure out how to fix one.
I already modified code in #1 to #3 and so there's no compilation error just runtime error.
So seems like the memory leak is the culprit since the code compiles just fine it just doesn't produce output that behaves as well
Delete the object causing the leak once you don't need it anymore or use some mechanism (like Qt's parent-child relationship or the signal-slot mechanism together with deleteLater() slot) that will do that for you.
So unmodify the code to have what you had in #1 minus compilation errors.I already modified code in #1 to #3 and so there's no compilation error just runtime error.
So you don't know what a memory leak is after all, do you?So seems like the memory leak is the culprit
Bookmarks