Hi,
I would like to ask , which declaration of object is faster?
or this:
Or in other words, is it best to use pointers to objects or objects themselves ?
I am going to use this for creating dialogs and windows in my app.
TIA
Printable View
Hi,
I would like to ask , which declaration of object is faster?
or this:
Or in other words, is it best to use pointers to objects or objects themselves ?
I am going to use this for creating dialogs and windows in my app.
TIA
When creating instances of subclasses of QObject it is almost always required to use pointers.
The fastest option is most likely a combination
i.e. on the stack and passing the text to the constructor instead of calling a setter.
However, as wysota has already said, widgets are most often created on the heap because they usually form a tree and their respective parent widget will attempt to delete them on its own destruction.
Which would not go together well with an object created on the stack
Cheers,
_