Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ExampleMain.cpp
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 13/01/2021
2
3/*************************************************************************
4 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#include <QTimer>
12#include <QApplication>
13#include <QtWebEngine>
14
15#include "TApplication.h"
16#include "TSystem.h"
17
18#include "ExampleWidget.h"
19
20int main(int argc, char **argv)
21{
22 QtWebEngine::initialize();
23
24 argc = 1; // hide all additional parameters from ROOT and Qt
25 TApplication app("uno", &argc, argv); // ROOT application
26
27 char* argv2[3];
28 argv2[0] = argv[0];
29 argv2[1] = 0;
30
31 QApplication myapp(argc, argv2); // Qt application
32
33 // let run ROOT event loop
34 QTimer timer;
35 QObject::connect( &timer, &QTimer::timeout, []() { gSystem->ProcessEvents(); });
36 timer.setSingleShot(false);
37 timer.start(4);
38
39 // top widget
40 ExampleWidget* widget = new ExampleWidget();
41
42 QObject::connect(&myapp, &QApplication::lastWindowClosed, &myapp, &QApplication::quit);
43
44 widget->show();
45
46 int res = myapp.exec();
47 return res;
48}
R__EXTERN TSystem * gSystem
Definition TSystem.h:559
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:417
int main()