52 this->force_C_locale_decimalseparator();
54 QFile stylesheet(
":/cxStyleSheet.ss");
55 stylesheet.open(QIODevice::ReadOnly);
56 this->setStyleSheet(stylesheet.readAll());
59 void Application::reportException(QString text)
61 QThread*
main = this->thread();
62 QThread* current = QThread::currentThread();
63 QString threadName = current->objectName();
64 if (threadName.isEmpty())
69 threadName =
"SECONDARY";
72 reportError(QString(
"Exception caught: [%1]\nin thread [%2]").arg(text).arg(threadName));
79 return QApplication::notify(rec, ev);
81 catch(std::exception& e)
83 this->reportException(e.what());
88 this->reportException(
"Unknown");
95 void Application::force_C_locale_decimalseparator()
98 QString radixChar = nl_langinfo(RADIXCHAR);
99 QString C_radixChar =
".";
101 if (radixChar != C_radixChar)
103 QLocale::setDefault(QLocale::c());
104 setlocale(LC_NUMERIC,
"C");
106 std::cout << QString(
"Detected non-standard decimal separator [%1], changing to standard [%2].")
111 QString number = QString(
"%1").arg(0.5);
112 if (!number.contains(C_radixChar))
113 std::cout <<
"Failed to set decimal separator." << std::endl;
120 if (!window->isVisible())
123 #ifdef __APPLE__ // needed on mac for bringing to front: does the opposite on linux
124 window->activateWindow();
int main(int argc, char *argv[])
void reportError(QString msg)
Application(int &argc, char **argv)
void bringWindowToFront(QWidget *window)
virtual bool notify(QObject *rec, QEvent *ev)