C++ (Qt)try{ double actual = calc.div(arg1, arg2);}catch (std::invalid_argument e){ // обрабатываешь исключение}
C++ (Qt)double actual = calc.div(arg1, arg2);if (actual != actual) // обработка ошибки
INCLUDEPATH += "../QtCalculator/dialog.h"INCLUDEPATH += ../build-QtCalculator-Desktop_Qt_5_2_0_MinGW_32bit-Debug/ui_dialog.hSOURCES += tst_testguiqtcalculatortest.cpp ../QtCalculator/dialog.cpp
#include "../QtCalculator/dialog.h"#include "../build-QtCalculator-Desktop_Qt_5_2_0_MinGW_32bit-Debug/ui_dialog.h"
Dialog dialog;
#include <QCoreApplication>#include <QNetworkAccessManager>#include <QDebug>#include <QWidget>#include <QObject>class Network : public QObject{ Q_OBJECTpublic: Network() {}public slots: void replyFinished (QNetworkReply*) { }};int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); Network n; QNetworkAccessManager *manager = new QNetworkAccessManager(); //QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), &n, SLOT(replyFinished(QNetworkReply*)));// QNetworkReply* m_http = manager->get(QNetworkRequest(QUrl("http://qt-project.org")));// QString russian = QString::fromUtf8(m_http->readAll());// qDebug() << russian; return a.exec();}//#include "main.moc"
#include <QCoreApplication>#include <QObject>class Network : public QObject{ Q_OBJECTpublic: Network() {}};int main(int argc, char *argv[]){ QCoreApplication a(argc, argv); Network n; return a.exec();}