HelloCanvas on Qt app using ROOT with VC2010&Qt 4.8.1

In case someone else has also though of trying to create Qt application that uses ROOT in Windows, here are my experiences on trying to get the “Minimal ROOT based Qt example” working in VC2010 & Qt 4.8.1 & ROOT 5.32.01 as given in root.cern.ch/download/doc/26ROOTandQt.pdf.

For those wanting an quick overview, as a result the example was build and run successfully, yet practically no usage tests have been done so far so I don’t how stable and good solution this is.

Rough description how the example was got running:

  1. Installed CMake
  2. Generated the VC2010 solution files from the CMakeLists provided by ROOT making sure that Qt is enabled and that correct qmake.exe is being used. See also footnote 1.
  3. Builded Root from the generated VC2010 solution.
  4. In solution explorer, manually build “Install”-project which created the standard include, lib etc. folders in the path given in CMAKE_INSTALL_PREFIX.
  5. Followed the instructions given in Qt root integration manual to produce HelloCanvas-project. Numerous tweaks to include path, ROOTSYS-handling, debugging environment and input libraries, but otherwise the example code build ok.
  6. When run, nothing but black screen is shown in the place where a graph should be shown. Applied patch 2(hack), build ROOT and HelloCanvas; now the graph shows.
  7. Wondering whether it was worth it and whether the solution as reliable enough to be used anywhere.

Any insights on questions like is the solution something that can be though of using in practice(on a quick look e.g. context menu on graph didn’t seem to work, a profound problem?) and what are the known limitations etc. in using TGQt, would be appreciated.

Footnote 1: The CMake configuration seems to be buggy and it created debug-configuration that was optimized (/O2) and was using non-debug runtime DLLs (/MD instead of /MDd). See patch 1.

SetUpWindows.cmake.txt (827 Bytes)
TGQt.cxx.txt (511 Bytes)

Hello
The short answer
"The QtRoot Windows version is NOT supported by CERN at all.
That explains your observation.
Check Qt-Root Windows also

Good news:
Upon downloading and installing

  1. Cygwin from : cygwin.com/setup.exe
  2. Qt libraries 4.8.2 for Windows (VS 2008, 234 MB): from qt.nokia.com/downloads/windows-cpp-vs2008
  3. Visual C++ 2008 Express: from microsoft.com/visualstudio/e … ns/express
    the shell script INSTALL_QTROOT.sh from svn export https://qtroot.svn.sourceforge.net/svnroot/qtroot/util/trunk/INSTALL_QTROOT.sh successfully built me the ROOT and QtRoot for Windows. Than I was able to build and execute the entire QtRoot test suite (see qtroot.svn.sourceforge.net/viewv … tExamples/) as well with no correction of the QtRoot source.




There is the bad news too :wink:

Over two months since the post… time goes fast. Sorry for the lack of attention; it’s not that the matter would have gone away.

Now looking at this, I’m again confused. First of all, what is the relation between qtroot in ROOT’s trunk that I’ve used and the separate project qtRoot project in Sourceforge? I’m not sure which one you’ve used, but suspect the latter. The build differences seem huge: I’m my hacks things started working(at least to some extent) simply by configuring the cmake-list and building ROOT(5.32), but the Sourceforge qtRoot instructs to build Qt without exceptions and the BNL website the README refers to is outdated - easy to prefer the first method which requires no external tools like cygwin. Also the screenshots you provided seems to refer to ROOT version 5.26 in the command line.

All in all it’s hard to tell what your report actual tells, although building without problems sounds good. I don’t remember testing the qtExamples and that sounds like something to dig in to at some point. Any further insights on the issue are welcome.

[quote=“tc3t”]Over two months since the post… time goes fast. Sorry for the lack of attention; it’s not that the matter would have gone away.[/quote] You are welcome … back :smiley: [quote=“tc3t”]Now looking at this, I’m again confused. First of all, what is the relation between qtroot in ROOT’s trunk that I’ve used and the separate project qtRoot project in Sourceforge?.[/quote]- Sourceforge is the QtRoot project home. To propagate it to the ROOT trunk I need to create the patch, then submit it “by mail”, then someone at CERN has to manually merge it. So this is quite expansive

  • As soon as the Windows version is concern I believe I did answer with my HelloCanvas on Qt app using ROOT with VC2010&Qt 4.8.1 says the script 'INSTALL_QTROOT.sh" was used. Check it to see it downloads the QtRoot from the SourceForge.[quote=“tc3t”]The build differences seem huge: I’m my hacks things started working(at least to some extent) simply by configuring the cmake-list and building ROOT(5.32), but the Sourceforge qtRoot instructs to build Qt without exceptions and the BNL website the README refers to is outdated - easy to prefer the first method which requires no external tools like cygwin. [/quote]I agree. The ideal solution would be to use “qmake/nmake”. It might not have required any special “configuring” at all. This is how QtROOT is built for Unix and Mac OS platforms.[quote=“tc3t”]Also the screenshots you provided seems to refer to ROOT version 5.26 in the command line.[/quote]Yes, your observation is correct the last version of QtROOT for Windows was ROOT 5.26. There was no demand to build any later version yet.[quote=“tc3t”]All in all it’s hard to tell what your report actual tells, although building without problems sounds good.[/quote]- It tells that QtRoot ROOT plugin per se is ok for Windows as well as for Unix and Mac OS .
  • It tells that one has to identify the main reason of the Windows trouble and solve it first to move on.[quote=“tc3t”]I don’t remember testing the qtExamples and that sounds like something to dig in to at some point. Any further insights on the issue are welcome.[/quote]You are welcome .Check the script I mentioned above again to see that one needs to patch (customize) the TWinNTSystem class to allow the QtROOt plugin to work correctly. This has nothing to do with the way the QtROOT is built. That class is NOT part of QtRoot. It is the part of the vanilla ROOT from CERN. This means either TWinNTSystem correction should be included into the CERN version of the class solving the issue forever or one has to create the patch for each ROOT release. The last version of ROOT such patch was created for is ROOT 5.26.
    This is :bulb: the MAIN obstacle. QtRoot plugin may be compiled /built on Windows one way or another. However it will not work correctly with the original version of TWinNTSystem.

[quote=“tc3t”]… I’m my hacks things started working(at least to some extent) simply by configuring the cmake-list and building ROOT(5.32),… easy to prefer the first method which requires no external tools like cygwin. Also the screenshots you provided seems to refer to ROOT version 5.26 in the command line. … [/quote]I agree it would be good to avoid the cygwin .
Did I understand correctly that you claim that you have the working solution to replace the “bash shell” scripts, namely “INSTALL_QTROOT.sh” and ROOT “configure”? Did you say one needs just Microsoft SDK to build ROOT for Windows from CERN SVN repository. If that is correct I am keen to see and try it out.

Thanks for the answer; it cleared the matter a bit. I tested the qtExamples and finally realized that the Qt-related code that ships in ROOT trunk is very different from QtRoot. The hello canvas builds and runs fine(although I’m not sure am I missing features such as context menus on canvas, I didn’t have those) but the other few examples that I tested didn’t build or work properly, which is no surprise given that I hadn’t build QtRoot itself, only ROOT with qt-option enabled.

Is ROOT changing too much to keep the QtRoot up-to-date without too much trouble?

[quote=“fine”]

[quote=“tc3t”]I don’t remember testing the qtExamples and that sounds like something to dig in to at some point. Any further insights on the issue are welcome.[/quote]You are welcome .Check the script I mentioned above again to see that one needs to patch (customize) the TWinNTSystem class to allow the QtROOt plugin to work correctly. This has nothing to do with the way the QtROOT is built. That class is NOT part of QtRoot. It is the part of the vanilla ROOT from CERN. This means either TWinNTSystem correction should be included into the CERN version of the class solving the issue forever or one has to create the patch for each ROOT release. The last version of ROOT such patch was created for is ROOT 5.26.
This is :bulb: the MAIN obstacle. QtRoot plugin may be compiled /built on Windows one way or another. However it will not work correctly with the original version of TWinNTSystem.[/quote]
Do you have any idea what’s the nature of the problem in TWinNTSystem? So far my experience tells that that it is possible to use ROOT for simple GUI objects like canvases and graphs in Qt application in Windows application without changes to TWinNTSystem. But the ‘test case’ has been minimal so I can’t judge much from that.

[quote=“fine”][quote=“tc3t”]… I’m my hacks things started working(at least to some extent) simply by configuring the cmake-list and building ROOT(5.32),… easy to prefer the first method which requires no external tools like cygwin. Also the screenshots you provided seems to refer to ROOT version 5.26 in the command line. … [/quote]I agree it would be good to avoid the cygwin .
Did I understand correctly that you claim that you have the working solution to replace the “bash shell” scripts, namely “INSTALL_QTROOT.sh” and ROOT “configure”? Did you say one needs just Microsoft SDK to build ROOT for Windows from CERN SVN repository. If that is correct I am keen to see and try it out.[/quote]
As descriped in the first post, I’ve build ROOT in Windows without shell scripts (or at least so that I haven’t had to use them myself) simply by using the CMakeLists provided in the ROOT trunk (see revision 39463). It involved using CMake to create VS solution files and then building ROOT from IDE. Even before it was possible to build ROOT in VS using http://rootbuilder.codeplex.com/, but CMake greatly enhanced the process - especially since the CMakeLists are provided by ROOT itself.

[quote=“tc3t”]… Do you have any idea what’s the nature of the problem in TWinNTSystem? So far my experience tells that that it is possible to use ROOT for simple GUI objects like canvases and graphs in Qt application in Windows application without changes to TWinNTSystem. But the ‘test case’ has been minimal so I can’t judge much from that. . . . [/quote] #-o I am little troubled with your " … Do you have any idea …" I do :unamused:
Well the original version of the TWinNTSystem created some redundant thread. It was introduced 15 years ago by Valeri Fine to work around of some Microsoft SDK limitation at the time (1996-1997). The version from qtroot.svn.sourceforge.net/viewv … winnt/src/ “converts” the Windows ROOT into the single-thread application (erasing the main the difference between Unix and Windows ports). You can see what was really done by comparing (use “svn diff” or equivalent) the files from QtRoot SVN against of its CERN SVN counterparts. It used to take me a few days to re-create TWinNTSystem against of the newer version of ROOT. However, I did not produce anything since ROOT 5.26 due lack of the demand.
Even though the thread is the MAIN problem there is another one too. One needs the ‘qtgui’ plugin too to be able to run all qtExamples and that means all ‘use cases’ I am aware about. Again the best solution would be to include qtgui into the ROOT CERN SVN. We have been talking about this for years . . . .
You may realize that some qtExamples require qtgui, others need just “qt”. The later is available from CERN SVN indeed.

No it is not . I did not remember making any correction within QtRoot for years (Check SVN history qtroot.svn.sourceforge.net/viewv … te#dirlist ) except may be one or two small bugs .

[quote=“tc3t”]… CMake greatly enhanced the process - especially since the CMakeLists are provided by ROOT itself.[/quote]Great , Thank you. What about we stop talking and start doing something ? :unamused:
What about, I produce the TWinNTSystem against the ROOT trunk; mean time , you will see how to build the entire QtROOT from qtroot.svn.sourceforge.net/viewvc/qtroot/trunk/ with CMake. (Send me the private message to get the details) Then we merge our results to run qtExamples test suit on Windows. Then I’ll try to convince ROOT team to accept it into CERN SVN?

[quote=“fine”][quote=“tc3t”]… CMake greatly enhanced the process - especially since the CMakeLists are provided by ROOT itself.[/quote]Great , Thank you. What about we stop talking and start doing something ? :unamused:
What about, I produce the TWinNTSystem against the ROOT trunk; mean time , you will see how to build the entire QtROOT from qtroot.svn.sourceforge.net/viewvc/qtroot/trunk/ with CMake. (Send me the private message to get the details) Then we merge our results to run qtExamples test suit on Windows. Then I’ll try to convince ROOT team to accept it into CERN SVN?[/quote]
Grand plans, but the idea of having Qt and ROOT work together sounds like something worth doing work for. The problem with CMaking QtRoot from my part is that I’m not familiar with generating CMakeLists, I just used the ones that was there when building ROOT (I clarified that in the first post). But unless there are some tricks in the current build process for QtRoot, CMaking doesn’t sound like too much of a concern, I’m more concerned about the QtRoot’s mention of the need the create a custom build of Qt. But I can take a look at CMake or try to be of help in others ways if needed, however I can’t promise quick results for reasons similar to those which caused the previous reply to take two months.

[quote=“tc3t”]… the idea of having Qt and ROOT work together sounds like something worth doing work for. The problem with CMaking QtRoot from my part is that I’m not familiar with generating CMakeLists, I just used the ones that was there when building ROOT (I clarified that in the first post). But unless there are some tricks in the current build process for QtRoot,[/quote]I hope no trick is needed. One just needs to provide
root.cern.ch/viewvc/trunk/graf2d … iew=markup for each QtRoot subsystem. That’s.[quote=“tc3t”] … I’m more concerned about the QtRoot’s mention of the need the create a custom build of Qt.[/quote] Umm, #-o where did you see that ? One needs no custom Qt build. In fact I used the Nokia binary distribution. I think I did tell that… The INSTALL_QTROOT.sh script can build Qt if needed. However it can use the per-installed one too.One needed some special flags with Qt3 . It was many years ago. and Qt3 support was discontinued anyway.

Great news that it isn’t required. The source for my impression was QtRoot’s readme.html:

[quote=“tc3t”] … QtRoot’s readme.html:

[quote]I.e. one is required to build the Qt version with the “thread” support and with no “exceptions”. One should turn off the Qt “xft” support to get the proper ROOT fonts scaling (especially for TLatex class) [/quote][/quote]It is really misleading, :frowning: I am sorry. It is about Qt3 and it is obsolete. One needs to clean things up :unamused: The entire file was abandoned and forgotten ](*,) . It has to be removed. Thank you.

[quote=“fine”][quote=“tc3t”] … QtRoot’s readme.html:

Mean time I “seeded” the CMakefile.txt for you start from :wink:
Check qtroot.svn.sourceforge.net/viewv … iew=markup
qtroot.svn.sourceforge.net/viewv … iew=markup
qtroot.svn.sourceforge.net/viewv … iew=markup

is anyone still working on updating QtRoot to the latest ROOT source? A working QT GUI with the latest ROOT libraries on Windows would work well for a new project of mine.

Yes. As far as I know ‘tc3t’ is working to adapt the Cmake-based build system. I’ll do that with the regular bash shell script + cygwin too . (sorry for some delay). The voluntaries are welcome too :wink:

No, I’m not working on CMake system, but currently there’s a Qmake-based proof-of-concept type of solution which enables building QtRoot using QtCreator on Windows. Don’t know if/when it’ll will become a usable solution for real use.

[quote=“ipc”]is anyone still working on updating QtRoot to the latest ROOT source? A working QT GUI with the latest ROOT libraries on Windows would work well for a new project of mine.[/quote]You should be able to build the QtRoot for Windows the way the post HelloCanvas on Qt app using ROOT with VC2010&Qt 4.8.1 describes.

Download and install ,

  1. Cygwin from : cygwin.com/setup.exe
  2. Qt libraries 4.8.3 for Windows (VS 2010 ): from releases.qt-project.org/qt4/sour … vs2010.exe
  3. Visual C++ 2010 Express: from microsoft.com/visualstudio/e … 10-express
  4. Adjust the ‘C:\cygwin\Cygwin.bat’ to set up your Qt and VC++ versions as follows:[code]
    @echo off

C:
chdir C:\cygwin\bin
call C:\Qt\4.8.3\bin\qtvars vsvars
bash --login -i[/code]Start “cygwin” (with 'C:\cygwin\Cygwin.bat), download and invoke the shell script INSTALL_QTROOT.sh from svn export https://qtroot.svn.sourceforge.net/svnroot/qtroot/util/trunk/INSTALL_QTROOT.sh. It downloads the source code of Qt Root (from SourceForge) and ROOT 5.34 (from CERN) and builds the working version of ROOT and QtRoot DLLs and EXEs for Windows using the downloaded CERN version of the ROOT “configure” shell script.

I am testing it. Any extra assistance with the testing will be appreciated a lot.

Attached are some code changes and scripts used to successfully get qtRoot rev 3545 (20 Nov 2012) build with VC2010, Qt 4.8.1 and ROOT 5.34.03 using qmake. Includes good amount of hacks so use with caution if at all.
qtroot_buildhacks.zip (7.43 KB)