Isis 3.0 Programmer Reference
Back | Home
QIsisApplication.cpp
1 #include "QIsisApplication.h"
2 
3 #include <locale.h>
4 
5 #include <QDesktopServices>
6 #include <QObject>
7 #include <QMessageBox>
8 #include <QUrl>
9 #if defined(__APPLE__)
10 #include <QtWebEngineWidgets/QWebEngineView>
11 #else
12 #include <QWebEngineView>
13 #endif
14 
15 #include "FileName.h"
16 #include "IException.h"
17 #include "IString.h"
18 
19 namespace Isis {
26  QIsisApplication::QIsisApplication(int &argc, char *argv[]) :
27  QApplication(argc, argv) {
28  // try to use US locale for numbers so we don't end up printing "," instead
29  // of "." where it might count.
30  setlocale(LC_NUMERIC, "en_US");
31 
32  QDesktopServices::setUrlHandler("http", this, "openUrl");
33  }
34 
35 
53  bool QIsisApplication::notify(QObject *rec, QEvent *ev) {
54  try {
55  return QApplication::notify(rec, ev);
56  }
57  catch(IException &e) {
58  QMessageBox::critical(NULL, "Error", e.what());
59  }
60  return false;
61  }
62 
63 
67  void QIsisApplication::openUrl(QUrl url) {
68  QWebEngineView *view = new QWebEngineView(NULL);
69  view->setAttribute(Qt::WA_DeleteOnClose);
70  view->load(url);
71  view->show();
72  }
73 }
const char * what() const
Returns a string representation of this exception in its current state.
Definition: IException.cpp:391
virtual bool notify(QObject *rec, QEvent *ev)
notify - this function overrides the QApplication notify as QT event handlers do not handle exception...
QIsisApplication(int &argc, char *argv[])
Constructor.
Isis exception class.
Definition: IException.h:99
void openUrl(QUrl url)
Open a URL in the browser specified by Isis.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:27:29