diff options
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp')
-rw-r--r-- | doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp b/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp new file mode 100644 index 000000000..8b4d10acb --- /dev/null +++ b/doc/codesnippets/doc/src/snippets/code/src_corelib_concurrent_qtconcurrentexception.cpp @@ -0,0 +1,35 @@ +//! [0] + +class MyException : public QtConcurrent::Exception +{ +public: + void raise() const { throw *this; } + Exception *clone() const { return new MyException(*this); } +}; + +//! [0] + + +//! [1] + +try { + QtConcurrent::blockingMap(list, throwFunction); // throwFunction throws MyException +} catch (MyException &e) { + // handle exception +} + +//! [1] + + +//! [2] + +void MyException::raise() const { throw *this; } + +//! [2] + + +//! [3] + +MyException *MyException::clone() const { return new MyException(*this); } + +//! [3] |