# Question about GUI

**URL:** <https://root-forum.cern.ch/t/question-about-gui/34871>\
**Category:** Newbie\
**Created:** [June 27, 2019, 11:23am UTC](https://root-forum.cern.ch/t/question-about-gui/34871 "2019-06-27T11:23:21Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![bg92](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bg92](https://root-forum.cern.ch/u/bg92)\
**Post date:** [June 27, 2019, 11:23am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/1 "2019-06-27T11:23:21Z")

</div>

Deall all,

I wanted to start working on the ROOT GUI, but I find it … “very old style” (the GuiBuilder too). I just read that “Originally the GUI classes were based on Hector Peraza’s Xclass’95 widget library”. Does it mean that the graphical style has not evolved since 95 ?? I probably miss something, but can’t we do something more recent? Other ideas?

Thanks for your help  
B

Ps: using 6.14/06

---

<div class="post-metadata">

**Author:** ![oshadura](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/oshadura/32/14460_2.png) [@oshadura](https://root-forum.cern.ch/u/oshadura)\
**Post date:** [June 27, 2019, 1:43pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/2 "2019-06-27T13:43:20Z")

</div>

Hi,

I believe you was reading a ROOT User guide (it was not updated for some time).  
Actually there are new developments in ROOT graphics and particularly in GUI.  
Please check more in presentation: [https://indico.cern.ch/event/587955/contributions/2938011/](https://indico.cern.ch/event/587955/contributions/2938011/)

---

<div class="post-metadata">

**Author:** ![bg92](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bg92](https://root-forum.cern.ch/u/bg92)\
**Post date:** [June 27, 2019, 3:17pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/3 "2019-06-27T15:17:14Z")

</div>

Thanks for your help. As far as I understand it, the only way to have a modern version of GUI with ROOT is to use a web based approach ? So basically, we code in C++ the gui, and it is display via JAVA tools into a browser ? Is that correct ?

I was working from this webpage:  
[https://root.cern.ch/root/htmldoc/guides/users-guide/WritingGUI.html](https://root.cern.ch/root/htmldoc/guides/users-guide/WritingGUI.html)

Do you confirm that there is no way to apply this procedure with modern graphics ?

Thanks a lot

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [June 27, 2019, 4:29pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/4 "2019-06-27T16:29:42Z")

</div>

Hi @bg92

Our long-term plans to implement all generic GUI widgets (TBrowser, TFitPanel, TCanvas, …) with web-based technology. There are prototypes for most of them - they will be moved from “ROOT::Experimental” namespace once they are ready for public use.

You still can use old TVirtualX-based GUI elements, but should not expect big new developments in this direction.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![bg92](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/49beb7/32.png) [@bg92](https://root-forum.cern.ch/u/bg92)\
**Post date:** [June 28, 2019, 7:06am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/5 "2019-06-28T07:06:32Z")

</div>

Hi @linev

thanks a lot for you reply.

When you say “ready for public use”, do you think it will be ready for ROOT7 (do you know when this version will be released)? Do you guys plan to make tutorials and examples ?

Thanks for you answers, and thanks for your work, it will be highly appreciated !

B

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [June 29, 2019, 2:05pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/6 "2019-06-29T14:05:22Z")

</div>

Hi,

WebGUI is important part of ROOT7 development. It is available already now - but under “Experimental” namespace while final interfaces not yet fixed. Actually basic functionality remains stable last 12 months, probably we can declare them as “stable” in the next release at the end of the year.

You are right - there is no proper tutorial for web-based GUIs.  
Before I was refering to RFitPanel, but meanwhile it is already complex to be used as tutorial. I will try to create several tutorials in next days.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 4, 2019, 7:17am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/7 "2019-07-04T07:17:18Z")

</div>

> [@bg92](#):
>
> Do you guys plan to make tutorials and examples ?

I add two tutorials to the ROOT master branch.

- `tutorials/webgui/webwindow` shows usage of RWebWindow with plain HTML. One can add any kind of external frameworks. Text and binary communication demonstrated.
- `tutorials/webgui/panel` shows usage of openui5 with RWebWindow. It includes model `TestPanelModel` class which is directly used as model object in openui5.

Both examples should be started just by calling: `root server.cxx`

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 6, 2019, 2:03pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/8 "2019-07-06T14:03:48Z")

</div>

Hi @linev,

Thank you very much for your example.  
I tested the sample code and sometimes output the following error.  
I downloaded the latest ROOT from github, my operating system is CentOS7.

Error in \<ROOT [webgui] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/webdisplay/src/RWebWindow.cxx:571 in bool ROOT::Experimental::RWebWindow::ProcessWS(THttpCallArg&)\>: missing number of acknowledged operations

In addition, I am also interested in qt5web, can you provide some sample code?

Best wishes,  
Hongyi

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 8, 2019, 9:25am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/9 "2019-07-08T09:25:10Z")

</div>

Hi,

> [@wuhongyi](#):
>
> Error in \<ROOT [webgui] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/webdisplay/src/RWebWindow.cxx:571

Which web browser you are using? I never observe the error before - this is indication of very basic communication error.

> [@wuhongyi](#):
>
> In addition, I am also interested in qt5web, can you provide some sample code?

If QWebEngine installed on your system and you build ROOT with `-Dqt5web=ON` flag, you just can use it exactly in the same way as browser. Just run:

```auto
root.exe --web=qt5 server.cxx

```

Advantage of this plugin - no real HTTP server is required.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 8, 2019, 11:27am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/10 "2019-07-08T11:27:48Z")

</div>

Hi Sergey,

I used firefox 60.7.2 for testing.  
But when I use google-chrome, there is no problem.

About qt5:(The version: qt/5.12.4)  
The sample code webgui/panel/server.cxx not working. The figure below shows the outputs.

 ![issue1](https://root-forum.cern.ch/uploads/default/original/3X/f/d/fda27083caa0b4194aa2b7071e128ed5a78e95c5.png)  
 ![issue2](https://root-forum.cern.ch/uploads/default/original/3X/9/3/93053202c118ceb89a47a6796f0bb2b2b520f4c8.png)

The code webgui/webwindow/server.cxx also has same issue.

Best wishes,  
Hongyi

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 8, 2019, 12:07pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/11 "2019-07-08T12:07:25Z")

</div>

> I used firefox 60.7.2 for testing.

It is little bit old, but should work.  
Can you check firefox browser console for error messages there?

> About qt5:(The version: qt/5.12.4)  
> The sample code webgui/panel/server.cxx not working. The figure below shows the outputs.

Strange, I was using exactly this version for testing and it was working for me.  
Now I have 5.13.0 and it still works.

But I see two error messages. First is about `AA_ShareOpenGLContexts`. Can you try to add following command to `webgui/qt5webdisplay/rootqt5.cpp`, line 104 (before creating application):

```auto
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);

```

Second about custom scheme. Please replace `#if QT_VERSION >= 0x051200` by `#if QT_VERSION >= 0x050C00` in lines 24 and 93. This is mistake, I will fix it soon in repository.

If fixes help, I will submit them to repository.

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 8, 2019, 2:25pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/12 "2019-07-08T14:25:37Z")

</div>

Hi Sergey,

The firefox browser console outputs messages about error:(Sorry, I don’t know how to make firefox only allow English to be output, even though I have deleted all other languages of the browser.)

```auto
载入页面时与 ws://localhost:9349/win1/root.websocket?key=1048305 的连接中断。
websocket error [object Event]

```

The outputs mean:

```auto
The connection to ws://localhost:9349/win1/root.websocket?key=1048305 was interrupted while loading the page.
websocket error [object Event]

```

* * *

About qt5:

I add QCoreApplication::setAttribute(Qt::AA\_ShareOpenGLContexts, true); before rootqt5.cpp line 104 and change QT\_VERSION in lines 24 and 93.

For the code webgui/panel/server.cxx outputs,

```auto
Processing server.cxx...
Assign UI5 dir /opt/rootmaster/ui5
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
root [1] Warning in <ROOT [Qt] Warning /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:31 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: rootscheme://root.server1/win1/jsrootsys/scripts/JSRootCore.js:939: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Error in <ROOT [Qt5] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rooturlschemehandler.cpp:112 in virtual void TWebGuiCallArg::HttpReplied()>: Qt5 request FAIL path win1 file root.longpoll
connection closed 1
Error in <ROOT [Qt] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:35 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1679: longpoll got short message in raw mode 0

root [1] .q

```

But the code webwindow/server.cxx only outputs as blow, it works normally.

```auto
Assign UI5 dir /opt/rootmaster/ui5
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.

```

Best wishes,  
Hongyi

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 8, 2019, 3:09pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/13 "2019-07-08T15:09:44Z")

</div>

Hi,

> [@wuhongyi](#):
>
> The firefox browser console outputs messages about error:(Sorry, I don’t know how to make firefox only allow English to be output, even though I have deleted all other languages of the browser.)

Something wrong with Firefox and websocket. I have no good idea. Can you try firefox with very simple ws.C example in $ROOTSYS/tutorials/http directory. It testing basic websocket functionality without all webgui extras.

> [@wuhongyi](#):
>
> But the code webwindow/server.cxx only outputs as blow, it works normally.

Means `tutorials/webgui/webwindow` works correctly? It is already good news!

But something wrong with openui5 in QWebEngine. First error I can see is:

> [@wuhongyi](#):
>
> ```auto
> Error in <ROOT [Qt5] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rooturlschemehandler.cpp:112 in virtual void TWebGuiCallArg::HttpReplied()>: Qt5 request FAIL path win1 file root.longpoll
> 
> ```

Try to add `gDebug = 1;` line into server.cxx before `window->Show();` method. And please send me your output.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 8, 2019, 3:49pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/14 "2019-07-08T15:49:07Z")

</div>

Hi Sergey,

I will try to test firefox with ws.C.  
Yes, the sample code `tutorials/webgui/webwindow` works correctly.

The debug mode output as blow,

```auto
[wuhongyi@localhost panel]$ root --web=qt5 server.cxx 
root [0] 
Processing server.cxx...
Assign UI5 dir /opt/rootmaster/ui5
Info in <TUnixSystem::Load>: loaded library /opt/rootmaster/lib/libROOTQt5WebDisplay.so, status 0
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
root [1] rootscheme://root.server1/win1/jsrootsys/scripts/JSRootCore.js:132: Set JSROOT.source_dir to rootscheme://root.server1/win1/jsrootsys/, dev 4/07/2019
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1968: Opening web socket at rootscheme://root.server1/win1/
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1985: configure longpoll rootscheme://root.server1/win1/root.longpoll
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1637: longpoll connect rootscheme://root.server1/win1/root.longpoll?raw_connect&key=1048305 raw = true
rootscheme://root.server1/win1/jsrootsys/scripts/JSRootPainter.js:1739: Get new longpoll connection with id 1618237641
rootscheme://root.server1/win1/jsrootsys/scripts/JSRoot.openui5.js:80: Load openui5 from rootscheme://root.server1/win1/rootui5sys/distribution/
root [1] .q
Error in <ROOT [Qt5] Log /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rooturlschemehandler.cpp:112 in virtual void TWebGuiCallArg::HttpReplied()>: Qt5 request FAIL path win1 file root.longpoll
TFolder dtor called for http

```

Best wishes,  
Hongyi

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 8, 2019, 4:06pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/15 "2019-07-08T16:06:23Z")

</div>

> [@wuhongyi](#):
>
> The debug mode output as blow,

Something wrong happens with OpenUI5 loading. It fails and as result, complete widget fails.

Try to create `.rootrc` file in directory with examples and put content:

```auto
WebGui.ForceHttp: 1

```

This will force usage of HTTP protocol. I suspect, that special URL handler does not work properly.

Regards,  
Sergey

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 9, 2019, 4:09am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/16 "2019-07-09T04:09:54Z")

</div>

Hi Sergey,

I tested the firefox browser with ws.C, but did not find any issues.

* * *

About **root --web=qt5 server.cxx**

When I create `.rootrc` file, the sample code `webgui/panel/server.cxx` can running, but the following warning is output.

```auto
Warning in <ROOT [Qt] Warning /home/wuhongyi/SoftwareCentOS/root-master/gui/qt5webdisplay/rootwebpage.cpp:31 in virtual void RootWebPage::javaScriptConsoleMessage(QWebEnginePage::JavaScriptConsoleMessageLevel, const QString&, int, const QString&)>: https://openui5.hana.ondemand.com/1.64.1/resources/sap-ui-core-nojQuery.js:90: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

```

Best wishes,  
Hongyi

---

<div class="post-metadata">

**Author:** ![linev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/2bfe46/32.png) [@linev](https://root-forum.cern.ch/u/linev)\
**Post date:** [July 9, 2019, 6:47am UTC](https://root-forum.cern.ch/t/question-about-gui/34871/17 "2019-07-09T06:47:33Z")

</div>

> [@wuhongyi](#):
>
> but the following warning is output.

This is known problem of OpenUI5, it should be resolved in the future versions.

> [@wuhongyi](#):
>
> When I create `.rootrc` file, the sample code `webgui/panel/server.cxx` can running

Means problem is combination of custom URL scheme handler and OpenUI5.  
Probably, it will be solved once synchronous `XMLHttpRequest` will be dropped in OpenUI5.  
For now one should use HTTP for all webgui plugins - this is that `WebGui.ForceHttp:1` is configuring

---

<div class="post-metadata">

**Author:** ![wuhongyi](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wuhongyi/32/16385_2.png) [@wuhongyi](https://root-forum.cern.ch/u/wuhongyi)\
**Post date:** [July 11, 2019, 1:54pm UTC](https://root-forum.cern.ch/t/question-about-gui/34871/18 "2019-07-11T13:54:57Z")

</div>

Hi Sergey,

Thank you for your help.  
I will try to upgrade our TVirtualX-based GUI program.

Best wishes,  
Hongyi
