problem using qgraphicsview
QGraphicsScene s;
s.addText("hello"); //s.addRect(0,0,100,100);
QGraphicsView v(&s);
v.show();
i am using qt4.5 , i try to write a simple qt program using qt creator to display a view containing a scene with text or a rectagle , when i run it its displaying only a blank view neither text or a rectangle being drawn.
can any body help
Re: problem using qgraphicsview
This is working fine on my machine.
Code:
#include <QApplication>
#include <Qtgui>
int main(int argc, char *argv[])
{
s.addText("hello"); //s.addRect(0,0,100,100);
v.show();
return a.exec();
}
Re: problem using qgraphicsview
Quote:
Originally Posted by
sandhyarani
QGraphicsScene s;
s.addText("hello"); //s.addRect(0,0,100,100);
QGraphicsView v(&s);
v.show();
i am using qt4.5 , i try to write a simple qt program using qt creator to display a view containing a scene with text or a rectagle , when i run it its displaying only a blank view neither text or a rectangle being drawn.
can any body help
You sure it doesn't go out of score with everything on stack? Try to put it in heap and see what happen...
Re: problem using qgraphicsview
Quote:
Originally Posted by
lni
You sure it doesn't go out of score with everything on stack?
Yes I am, because app.exec() is the barrier here. untill you dont terminate application execution, these objects will be in memory, and the program is running absolutely fine.
Quote:
Originally Posted by
lni
Try to put it in heap and see what happen...
Same results.:););)