Hello all,
I think a widget constructor in Qt will return a zero pointer if construction can't be done. Is that right? Well, how is that done?
Qt Code:
  1. AThing* myThing = new AThing(someParameters);
  2. if(myThing)//check to see if made correctly
  3. ...
To copy to clipboard, switch view to plain text mode 
When I try to return anything from my constructors I get a compiler error - can't return a value. new() is doing the work here and is returning the pointer, no? Can I get my constructor to get a zero pointer (or any other value) returned from new()?

In the above example AThing() needs a port, or a file, or some memory, which it can't get. After the construction, I can check with some func e.g.
bool myThing->constructedProperly() but maybe my object failed to allocate enough memory for itself so that I can't even call that func.

thanks
K