Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of QException?

In Qt 5.0 - Qt Introduced the QException class.

What is benifit of inheriting from this class? What if we throw a class that does not inherit from the QException class?

Thank you in advance!

like image 216
DesignIsLife Avatar asked Dec 12 '22 06:12

DesignIsLife


1 Answers

In short, you can find the answers by reading the relatively short documentation.


Q: What is benefit of inheriting from this class?

This is the corresponding part of the documentation:

The QException class provides a base class for exceptions that can transferred across threads.

In addition to that, it integrates pretty well with the QtConcurrent feature set, including QFuture.


Q: What if we throw a class that does not inherit from the QException class?

This is the corresponding part of the documentation:

If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.

like image 82
lpapp Avatar answered Dec 25 '22 04:12

lpapp