ROOT Version: 6.22.08 Platform: Windows 10 Compiler: MSCV2019 16 x86
Dear @linev,
You recently explained to me in the post HERE how to embed RCanvas, TCanvas and RGeomViewer inside QT. I thank you for this as your explanations were of great help to me. I was using LINUX and everything worked perfectly.
Today, I am trying to perform the same on windows. I have compiled successfully ROOT with qt5web, root7, and webgui.
However, I am asking for your help again regarding the compilation of the example you provided.
When I try to compile the project, the following error happens:
Conversion of ‘int’ to ‘_Ty’ requires a narrowing conversion
This happens for Canvas->SetSize({width(), height()})
I can solve it by writting: Canvas->SetSize({(ROOT::Experimental::RPadLength::Pixel)width(), (ROOT::Experimental::RPadLength::Pixel)height()})
Am I missing something or is it not planned to work on windows?
Thanks a lot in advance for your help.
Thomas
In fact the compilation works but not the execution. I do not know if this comes from my modification (I doubt). I send you a picture of the crash, maybe you already got this?
I have another application, where I using component similar to TCanvasWidget.
And I test it on all supported platforms - Linux, Mac and Windows.
But I didnot test qt5web tutorial directly.
Your changes like (ROOT::Experimental::RPadLength::Pixel)width() should be fine - seems to be on windows QWidget returns size as float. Could you check that width() and height() returns reasonable values here. Or just replace them with some fixed values like 600 and 400
I will try to run my Windows VM, but it could take time.
Dear Sergey,
Thanks a lot for your fast reply. Unfortunately, I cannot test what width() and height() returns because, despite the application compiles, it does not run.
I believe the error I encountered is not linked with the int conversion. Maybe it could originate from a problem in visual studio as the exception occurs with RtlZeroMemory which seems to be a pure windows routine.
I will keep you informed if I come with a solution.
Thanks,
Thomas
Hello,
I performed some additional tests by removing every root object from qt5web. It happens that as long as I do not include a root header, the program runs. At the moment I include the root headers (TApplication.h, TSystem.h, TF1.h …etc), the program gives the error I posted above.
I do not understand why and maybe this is originating from a wrong .pro file?
I used the .pro file from the qt5web example and added:
It seems the problem comes from TVersionCheck.h as, when I remove the code line inside this header, including the other header such as TApplication.h for instance, does not lead to a crash at execution. I suspect that I do not compile my qt5web with the same compiler I used to build root…
I compile root with:
Unfortunately, it creates the same behavior as when I compile with QtCreator.
I compiled the qt5web application within the x86 command prompt for VS2019 linking with Qt5.15.0. I also tried with cmake-gui launched from the x86 command prompt for VS2019. Both compilations (cmake and cmake-gui) are going perfectly, in release or debug mode.
However, when I launch the executable, the “Root session” prompt appears and then closes without any further message. The qt5web program is executed (I see it in my task manager) and then killed. The crash does not indicate anything.
Could it be from our version of MSVC or QT? You use MSVC2017 with Qt5.12.6 and I use MSVC2019 with Qt5.15.0.
Thanks again for your availability and help.
Best,
Thomas
I upgrade my VC and Qt5 installations to recent ones - now I using Qt5.15.2 and latest MSVC2019.
I manage to compile ROOT and it works for me.
Also root --web=qt5 works properly - after one types new TBrowser Qt5 web engine widgets are used to show it.
But separate qt5web.exe does not work - it crashes in very early stage.
I suspect mismatch in compilation flags, but have no much experience there.
Probably, we should ask our Windows expert Bertrand @bellenot to see why it could happen.
I create branch with all necessary changes.
Hi, yes this might well be a compilation flag issue, I’ll have to try myself. But before that, could you try to add these lines at the beginning of your CMakeLists.txt