several problems here:
0)
No code tags!! Please edit your post and add them so that your code is actually readable.
[code ] [/ code]
1)
pushbutton =new QPushButton; // -(a)
pushbutton=ui->pushbutton; // -(b)
Why make a new button, (a), then immediately ignore it/reassign it (b) - this is a memory leak, and you just made a new button when you already have one!
2)
How can anybody tell you accuratley what is wrong with Form when you have shown ZERO code that describes Form class.
3)
Scope. You need to learn about what happens to stack variables when they go out of scope.
You code,
|
Source code
|
1
2
3
4
5
|
void MainWindow::on_pushbutton_clicked()
{
Form f;
f.show();
} // <---- f is destroyed here. You will only see your form for a fraction of a second, if at all.
|
is incorrect. Please learn how c++ handles stack and heap variables, and their limitations from scope.