Yet another bunch of doubts!
1.use of qapplication(argc,argv)?==>why we pass the command line arguments to app object?
2.why a heap is needed to delete automatically the child objects of a widget ,when it is deleted,and whyy it is not possible on a stack
ie why we use new operator???
3. clear difference between callback functions,event listeners and slot-signal concept?
Re: Yet another bunch of doubts!
Look, this is a Qt forum, not programming basics forum.
All your questions are covered in the basics of programming, and basics of C programming.
Get a good book on the subject, or find many explanations about it on Google.
You are welcome to ask Qt related questions.
Re: Yet another bunch of doubts!
Quote:
Originally Posted by
Nishant
1.use of qapplication(argc,argv)?==>why we pass the command line arguments to app object?
Because QApplication can take some command line arguments, influencing the rendering of your program. Read this.
Quote:
Originally Posted by
Nishant
2.why a heap is needed to delete automatically the child objects of a widget ,when it is deleted,and whyy it is not possible on a stack
ie why we use new operator???
Actually you're looking at it from the wrong perspective. If you would be allocating everything on stack, you wouldn't have any reason to create an object structure. It is necessary because allocation on heap requires some sort of data management to prevent memory leaks. Allocating on the heap is much more convenient because you don't have to worry about your QObject going out of scope. A minor worry should be that you might loose the pointer to your QObject, but if you've written your program properly the object should be deleted when it shuts down.
Quote:
Originally Posted by
Nishant
3. clear difference between callback functions,event listeners and slot-signal concept?
Read this and this. Maybe it clears something up for you.