Reputation: 177
I working with qt, I have a big project with gui and several threads.
I want to add exaption handling. I googled it and didn't find any tutorial or some relevant answer.
In some sites I read that qt not support try catch.
Is qt support try catch? Or some error handling? If yes, can some one give some direction or tutorial?
Tank you.
Upvotes: 0
Views: 2073
Reputation: 1201
You're not allowed to throw an exception through a signal-slot invocation. Everything else you want to do with exceptions in a Qt application is allowed.
http://doc.qt.io/qt-5/exceptionsafety.html#signals-and-slots
Throwing an exception from a slot invoked by Qt's signal-slot connection mechanism is considered undefined behaviour, unless it is handled within the slot.
class MyClass : public QObject
{
Q_OBJECT
public slots:
void mySlot()
{
throw std::logic_error(""); // Undefined behavior when invoked by a signal
}
};
Upvotes: 2