PDA

View Full Version : how to use try... catch in qt4.6.3?



weixj2003ld
10th May 2020, 11:24
Hi ,every one.
my program with qt 4.6.3+vs2008,and found that there is not try ... catch in Qt4.6.3.How to use try... catch in vs 2008 debug mode?thank you very much!

Lesiok
10th May 2020, 12:24
Qt is a library not a language. Use try-catch like in normal C++ program.

weixj2003ld
10th May 2020, 13:52
thank you ,I try it.

d_stranz
10th May 2020, 16:13
But be aware that exceptions will cause problems if they are thrown in a Qt event handler (like a slot). See this stackoverflow article (https://stackoverflow.com/questions/10075792/how-to-catch-exceptions-in-qt/10076352). So, you should not be writing code that throws exceptions if you are writing it for use with Qt, unless isolate it to within code that does not use the Qt event loop.