32 this->force_C_locale_decimalseparator();
34 QFile stylesheet(
":/cxStyleSheet.ss");
35 stylesheet.open(QIODevice::ReadOnly);
36 this->setStyleSheet(stylesheet.readAll());
39 void Application::reportException(QString text)
41 QThread*
main = this->thread();
42 QThread* current = QThread::currentThread();
43 QString threadName = current->objectName();
44 if (threadName.isEmpty())
49 threadName =
"SECONDARY";
52 reportError(QString(
"Exception caught: [%1]\nin thread [%2]").arg(text).arg(threadName));
59 return QApplication::notify(rec, ev);
61 catch(std::exception& e)
63 this->reportException(e.what());
68 this->reportException(
"Unknown");
75 void Application::force_C_locale_decimalseparator()
78 QString radixChar = nl_langinfo(RADIXCHAR);
79 QString C_radixChar =
".";
81 if (radixChar != C_radixChar)
83 QLocale::setDefault(QLocale::c());
84 setlocale(LC_NUMERIC,
"C");
86 std::cout << QString(
"Detected non-standard decimal separator [%1], changing to standard [%2].")
91 QString number = QString(
"%1").arg(0.5);
92 if (!number.contains(C_radixChar))
93 std::cout <<
"Failed to set decimal separator." << std::endl;
100 if (!window->isVisible())
103 #ifdef __APPLE__ // needed on mac for bringing to front: does the opposite on linux 104 window->activateWindow();
111 QWidget *mainwindow = Q_NULLPTR;
112 foreach(mainwindow, QApplication::topLevelWidgets()) {
113 if(mainwindow->objectName() ==
"main_window")
123 T
object = mainwindow->findChild<T>(objectName);
129 QAction* action = findMainWindowChildWithObjectName<QAction*>(actionName);
T findMainWindowChildWithObjectName(QString objectName)
int main(int argc, char *argv[])
void reportError(QString msg)
Application(int &argc, char **argv)
void bringWindowToFront(QWidget *window)
void triggerMainWindowActionWithObjectName(QString actionName)
QWidget * getMainWindow()
virtual bool notify(QObject *rec, QEvent *ev)
Namespace for all CustusX production code.