Struct qt_core::QException
source · #[repr(C)]pub struct QException { /* private fields */ }
Expand description
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
C++ class: QException
.
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
class MyException : public QException { public: void raise() const override { throw *this; } MyException *clone() const override { return new MyException(*this); } };
QException subclasses must be thrown by value and caught by reference:
try { QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException } catch (MyException &e) { // handle exception }
If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.
When using QFuture, transferred exceptions will be thrown when calling the following functions:
Implementations§
source§impl QException
impl QException
sourcepub unsafe fn clone(&self) -> Ptr<QException>
pub unsafe fn clone(&self) -> Ptr<QException>
In your QException subclass, reimplement clone() like this:
Calls C++ function: virtual QException* QException::clone() const
.
In your QException subclass, reimplement clone() like this:
MyException *MyException::clone() const { return new MyException(*this); }
sourcepub unsafe fn copy_from(
&self,
other: impl CastInto<Ref<QException>>
) -> Ref<QException>
pub unsafe fn copy_from( &self, other: impl CastInto<Ref<QException>> ) -> Ref<QException>
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
Calls C++ function: QException& QException::operator=(const QException& other)
.
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
class MyException : public QException { public: void raise() const override { throw *this; } MyException *clone() const override { return new MyException(*this); } };
QException subclasses must be thrown by value and caught by reference:
try { QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException } catch (MyException &e) { // handle exception }
If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.
When using QFuture, transferred exceptions will be thrown when calling the following functions:
sourcepub unsafe fn new() -> CppBox<QException>
pub unsafe fn new() -> CppBox<QException>
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
Calls C++ function: [constructor] void QException::QException()
.
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
class MyException : public QException { public: void raise() const override { throw *this; } MyException *clone() const override { return new MyException(*this); } };
QException subclasses must be thrown by value and caught by reference:
try { QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException } catch (MyException &e) { // handle exception }
If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.
When using QFuture, transferred exceptions will be thrown when calling the following functions:
sourcepub unsafe fn new_copy(
other: impl CastInto<Ref<QException>>
) -> CppBox<QException>
pub unsafe fn new_copy( other: impl CastInto<Ref<QException>> ) -> CppBox<QException>
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
Calls C++ function: [constructor] void QException::QException(const QException& other)
.
Qt Concurrent supports throwing and catching exceptions across thread boundaries, provided that the exception inherit from QException and implement two helper functions:
class MyException : public QException { public: void raise() const override { throw *this; } MyException *clone() const override { return new MyException(*this); } };
QException subclasses must be thrown by value and caught by reference:
try { QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException } catch (MyException &e) { // handle exception }
If you throw an exception that is not a subclass of QException, the Qt functions will throw a QUnhandledException in the receiver thread.
When using QFuture, transferred exceptions will be thrown when calling the following functions:
sourcepub unsafe fn raise(&self)
pub unsafe fn raise(&self)
In your QException subclass, reimplement raise() like this:
Calls C++ function: virtual void QException::raise() const
.
In your QException subclass, reimplement raise() like this:
void MyException::raise() const { throw *this; }
Trait Implementations§
source§impl CppDeletable for QException
impl CppDeletable for QException
source§impl DynamicCast<QUnhandledException> for QException
impl DynamicCast<QUnhandledException> for QException
source§unsafe fn dynamic_cast(ptr: Ptr<QException>) -> Ptr<QUnhandledException>
unsafe fn dynamic_cast(ptr: Ptr<QException>) -> Ptr<QUnhandledException>
Calls C++ function: QUnhandledException* dynamic_cast<QUnhandledException*>(QException* ptr)
.
source§impl StaticDowncast<QUnhandledException> for QException
impl StaticDowncast<QUnhandledException> for QException
source§unsafe fn static_downcast(ptr: Ptr<QException>) -> Ptr<QUnhandledException>
unsafe fn static_downcast(ptr: Ptr<QException>) -> Ptr<QUnhandledException>
Calls C++ function: QUnhandledException* static_cast<QUnhandledException*>(QException* ptr)
.
source§impl StaticUpcast<QException> for QUnhandledException
impl StaticUpcast<QException> for QUnhandledException
source§unsafe fn static_upcast(ptr: Ptr<QUnhandledException>) -> Ptr<QException>
unsafe fn static_upcast(ptr: Ptr<QUnhandledException>) -> Ptr<QException>
Calls C++ function: QException* static_cast<QException*>(QUnhandledException* ptr)
.