title: How to catch exceptions with Qt platform independently?
body: <p>I'm using boost::date_time in my project. When date is not valid it thorws std::out_of_range C++ exception. In Qt's gui application on windows platform it becomes SEH exception, so it doesn't catched with try|catch paradigm and programm dies. How can I catch the exception platform independently?</p>
  
  <pre><code>try{
      std::string ts("9999-99-99 99:99:99.999");
      ptime t(time_from_string(ts))
  }
  catch(...)
  {
      // doesn't work on windows
  }
  </code></pre>
  
  <hr>
  
  <p><strong>EDITED:</strong>
  If somebody didn't understand, I wrote another example:</p>
  
  <p><strong>Qt pro file:</strong></p>
  
  <pre><code>TEMPLATE = app
  DESTDIR  = bin
  VERSION  = 1.0.0
  CONFIG  += debug_and_release build_all
  TARGET = QExceptExample
  SOURCES += exceptexample.cpp \
             main.cpp
  HEADERS += exceptexample.h
  </code></pre>
  
  <p><strong>exceptexample.h</strong></p>
  
  <pre><code>#ifndef __EXCEPTEXAMPLE_H__
  #define __EXCEPTEXAMPLE_H__
  
  #include &lt;QtGui/QMainWindow&gt;
  #include &lt;QtGui/QMessageBox&gt;
  #include &lt;QtGui/QPushButton&gt;
  #include &lt;stdexcept&gt;
  
  class PushButton;
  class QMessageBox;
  
  class ExceptExample : public QMainWindow
  {
    Q_OBJECT
    public:
      ExceptExample();
      ~ExceptExample();
    public slots:
      void throwExcept();
    private:
      QPushButton * throwBtn;
  };
  
  #endif
  </code></pre>
  
  <p><strong>exceptexample.cpp</strong></p>
  
  <pre><code>#include "exceptexample.h"
  
  ExceptExample::ExceptExample()
  {
    throwBtn = new QPushButton(this);
    connect(throwBtn, SIGNAL(clicked()), this, SLOT(throwExcept()));
  }
  
  ExceptExample::~ExceptExample()
  {
  }
  
  void ExceptExample::throwExcept()
  {
    QMessageBox::information(this, "info", "We are in throwExcept()", 
                             QMessageBox::Ok);
    try{
      throw std::out_of_range("ExceptExample");
    }
    catch(...){
      QMessageBox::information(this, "hidden", "Windows users can't see "
                               "this message", QMessageBox::Ok);
    }
  }
  </code></pre>
  
  <p><strong>main.cpp</strong></p>
  
  <pre><code>#include "exceptexample.h"
  #include &lt;QApplication&gt;
  
  int main(int argc, char* argv[])
  {
    QApplication app(argc, argv);
    ExceptExample e;
    e.show();
    return app.exec();
  }
  </code></pre>