What is the purpose of QException?

c++, qexception, qt, qt5, qtconcurrent

Solution

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.

Problem

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!

Original source