[Qt-interest] How to handle error

Sean Harmer sean.harmer at maps-technology.com
Fri Jun 25 12:28:47 CEST 2010


On Friday 25 June 2010 11:08:20 Ramesh wrote:
> I don't think any class in Qt which tell the reason why error is appeared.
> 
> Some time we do mistake in  writing the programmes, some programme run with
> error only, it's pretty tough to identify the cause for error in Debugging
> the code.
> 
> For example in connecting the SIGNAL of one class to SLOT of another  need
> to have many conditions like, class object should be meta object,
> 
> parameters should be same. even if we do small mistake also programme will
> compile, but signal slot will not work.
> 
> Like this there may be verity of problems.
> 
> Is there any class which popup error number, using that we can identify
> easily the cause for problem. Is there any such mechanism in Qt?

For such runtime errors you can export the environment variable 
QT_FATAL_WARNINGS="1" and then run your application. If you have a broken 
connect() statement this will cause Qt to print a warning and assert so you 
can easily find where in your code the problematic connection is.

Sean



More information about the Qt-interest-old mailing list