QtRoot support for Qt4

I’m toying with QtRoot since I’d like to build a Qt event viewer for my experiment while taking advantage of some nice features of Root like histograms. I’m using Root 5.34.07 with Qt 4.8.5 on a 64 bit ArchLinux platform. I began with a very simple setup, just trying to use the Qt layer to draw a histogram inside my Qt application using a TQtWidget. Besides that triggering [url=https://root-forum.cern.ch/t/tqtwidget-interferes-with-qgraphicsview/16655/1 very strange behavior[/url], I find that the GUI is broken as other users [url=https://root-forum.cern.ch/t/root-based-qt-applications/15476/1 before me. This is known since long time (Root 5.28) as one can see in that thread, and still it’s broken.
The user’s guide states that QtRoot works with Qt3 and the support for Qt 4.3 (I guess this includes also other 4.x releases) is still experimental. Qt3 is legacy code and all the modern Linux distributions including SLC6 ship a 4.x version of Qt, so for QtRoot to be usable it has to be ported to Qt 4.x, in m opinion. I’d like to know if there are plans to complete the port and eventual release milestone.

I’m sorry to bump a thread that seems to not be of interest for many persons, but I really need some clarification about the state of QtRoot. It seems to be quite widely used and yet be plagued by long-standing bugs. I’ve been able to reproduce the buggy behavior and the hackish fix described in [url=https://root-forum.cern.ch/t/repainting-tqtwidget-frustration-returns/14399/1 old thread[/url] dating back to 2010. Which is now quite some time ago…
Is QtRoot support discontinued even for urgent bug fixes? Why there is no clear word about its state in the Root documentation or site (at least, nothing I’ve found)? And most of all, why such a problematic piece of Root is distributed with mainline code if it’s broken since long time and apparently there’s no willing to fix it?
I don’t want to hurt somebody nor to start a flame war, I just need to understand whether I can think about QtRoot as a concrete possibility for my code needs or not (I think it’s a really nice idea and potentially very useful).

If it’s any consolation I had about the same idea a week or two ago; I wanted to use Qt (5 actually, not 4) and ROOT to make a basic application for my experiment. I found a few examples of putting a histogram/graph into a Qt Widget, but as you say they all had dealbreaking bugs. Even though things would often draw properly, getting it to respond to window resizes, moving the window etc simply didn’t work so I gave up. I would love to see a simple, clear example of embedding a TCanvas in a (TQt)Widget that works with Qt4 or Qt5.

If it is of any help, I found a way to make QtRoot usable, at least if you don’t care about performance of the GUI and some leftover minor bugs:

  1. Use root>=5.34.10 or apply the patch described here:

  2. The repaint bug can be workaround by properly setting the fill color:


to fix the bug described here:

  1. The initial content of the canvas (i.e. the plot displayed just after the start of the QtRoot application) could be broken; the only way I found to fix it is to force a resize of the widget (since a resize seems the only thing that forces a correct redraw of the canvas) and then restore the original size:
qtRootWidget->resize(qtRootWidget->width() - 100, qtRootWidget->height() - 100);
qtRootWidget->resize(qtRootWidget->width() + 100, qtRootWidget->height() + 100);

in the constructor of the main window object. I think that the drawing area has to be severely damaged by the resize to trigger the repaint, so use a value greater than 100 if the above code doesn’t work.

The recipes above are the outcome of three days of searches and trials. They look a bit shamanic and maybe they are indeed, but that’s the only way I could make QtRoot barely usable. There are some leftover bugs (like context menu never going away once displayed, until you click on one of its entries) which I wasn’t able to squash or workaround, but now at least my application works.
Hope this helps…