Re: my QGraphicView problem
try this -
Code:
deneme
::deneme(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
scene
->addPixmap
(QPixmap::fromImage(image
));
gr->setScene(scene);
setCentralWidget(gr);
}
Does this work for you ?? You are creating scene as local object which will be destroyed after the constructor code .
Re: my QGraphicView problem
Yes, when scene was made as private variable in class, then it worked. Thanks. But Why is it destroyed I can't understand? Because graphics view widget is not destroyed. And When I also made this simple code in button click, same thing did not work although it is not in the constructor.
Anyway It must be global (w.r.t. class) variable in the class.
Re: my QGraphicView problem
If you declare a variable in a method, it will be destroyed when it goes out of scope (i.e. when the method is left).
Your scene is local to the constructor's body. It is destroyed after the constructor is completed!