19 #include <QDockWidget>
33 this->force_C_locale_decimalseparator();
35 QFile stylesheet(
":/cxStyleSheet.ss");
36 stylesheet.open(QIODevice::ReadOnly);
37 this->setStyleSheet(stylesheet.readAll());
40 void Application::reportException(QString text)
42 QThread*
main = this->thread();
43 QThread* current = QThread::currentThread();
44 QString threadName = current->objectName();
45 if (threadName.isEmpty())
50 threadName =
"SECONDARY";
53 reportError(QString(
"Exception caught: [%1]\nin thread [%2]").arg(text).arg(threadName));
60 return QApplication::notify(rec, ev);
62 catch(std::exception& e)
64 this->reportException(e.what());
69 this->reportException(
"Unknown");
76 void Application::force_C_locale_decimalseparator()
79 QString radixChar = nl_langinfo(RADIXCHAR);
80 QString C_radixChar =
".";
82 if (radixChar != C_radixChar)
84 QLocale::setDefault(QLocale::c());
85 setlocale(LC_NUMERIC,
"C");
87 std::cout << QString(
"Detected non-standard decimal separator [%1], changing to standard [%2].")
92 QString number = QString(
"%1").arg(0.5);
93 if (!number.contains(C_radixChar))
94 std::cout <<
"Failed to set decimal separator." << std::endl;
101 if (!window->isVisible())
104 #ifdef __APPLE__ // needed on mac for bringing to front: does the opposite on linux
105 window->activateWindow();
112 QWidget *mainwindow = Q_NULLPTR;
113 foreach(mainwindow, QApplication::topLevelWidgets()) {
114 if(mainwindow->objectName() ==
"main_window")
124 T
object = mainwindow->findChild<T>(objectName);
130 QAction* action = findMainWindowChildWithObjectName<QAction*>(actionName);