TGListTree invisible [SOLVED]

I am developing my first ever application using ROOT GUI classes. In my application I use a class derived from TGListTree to display some data. First I could not make it work but then I happend to switch from the native to the qt backend and suddenly the TGListTree showed up. The following code is a short example where the TGListTree only shows with Gui.Backend set to qt:

#include <TApplication.h> #include <TGFrame.h> #include <TGCanvas.h> #include <TGListTree.h> int main(int argc, char** argv) { TApplication* runroot = new TApplication("TreeTest", &argc, argv); TGMainFrame* mainframe = new TGMainFrame(); TGCanvas* canvas = new TGCanvas(mainframe,100,100); mainframe->AddFrame(canvas, new TGLayoutHints(kLHintsExpandX|kLHintsExpandY)); TGListTree* tree = new TGListTree(canvas); canvas->SetContainer(tree); tree->AddRoot("Top item"); mainframe->MapSubwindows(); mainframe->Resize(mainframe->GetDefaultSize()); mainframe->MapWindow(); runroot->Run(); return 0; }
I have confirmed that using “Gui.Backend: native” turns the TGListTree invisible on two different setups:

  1. AMD64 Gentoo linux, root-5.26/00b, libqtgui-4.6.3
  2. i686 Ubuntu linux, root-5.27/04, libqtgui-4.6.2

The same problem emerges whether I run the program in compiled or in interpreted mode.

Should I report this as a bug or have I missed something that QT does but not the native backend? I have not worked with ROOT for long so I might have made some mistakes.

Thanks in advance


Just replace: TGListTree* tree = new TGListTree(canvas);by:

Cheers, Bertrand.

It works without any problems now.

Thank you!