# HelloCanvas on Qt app using ROOT with VC2010&Qt 4.8.1

**URL:** <https://root-forum.cern.ch/t/hellocanvas-on-qt-app-using-root-with-vc2010-qt-4-8-1/14153>\
**Category:** ROOT\
**Created:** [April 16, 2012, 7:24pm UTC](https://root-forum.cern.ch/t/hellocanvas-on-qt-app-using-root-with-vc2010-qt-4-8-1/14153 "2012-04-16T19:24:56Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![tc3t](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/c5a1d2/32.png) [@tc3t](https://root-forum.cern.ch/u/tc3t)\
**Post date:** [April 16, 2012, 7:24pm UTC](https://root-forum.cern.ch/t/hellocanvas-on-qt-app-using-root-with-vc2010-qt-4-8-1/14153/1 "2012-04-16T19:24:56Z")

</div>

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](http://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](https://root-forum.cern.ch/uploads/default/original/2X/2/213c29711f1c5915a6a6511b69580fc4ee56bd75.txt) (827 Bytes)  
[TGQt.cxx.txt](https://root-forum.cern.ch/uploads/default/original/2X/e/efc499e06e49ec6a8e0b70461a2ad7f746ea3eff.txt) (511 Bytes)

---

_[View the full topic](https://root-forum.cern.ch/t/hellocanvas-on-qt-app-using-root-with-vc2010-qt-4-8-1/14153)._
