Dock the editor tab into a Qt window

I’m developing a GUI using Qt. I can embed a Root canvas into a Qt widget, but now I’d like to embed also the editor tab into a Qt widget, to be able to dock it in the Qt main window. Is this feasible? I’d need some guidance to understand where to start. Thanks.

(see next post by linev for better response to the problem)

[size=65]To me the question seems analogous to asking whether a WxWidgets (or any other GUI toolkit) window could be embedded in a Qt widget, which sounds if not infeasible, at least far from trivial (would be happy to learn being wrong about this, though). For example the Sourceforge QtRoot and Qoot has GedEditor implemented as native Qt-widget and I don’t remember that any of the the ROOT-native windows that have control widgets would show when using Qt.[/size]

Hi,

Since a long time we are using so-called GSI QtRoot interface.
Its idea - embed ROOT canvas and other widgets in normal Qt widgets.
We also enable usage of ROOT editors - see attached image


Original code for GSI QtRoot interface you can find in $ROOTSYS/gui/qtgsi directory.
We are using modified version, which can be found in:
https://subversion.gsi.de/go4/trunk/qt4/Go4QtRoot/

Code to instantiate ROOT editor in the QWidget from
https://subversion.gsi.de/go4/trunk/qt4/Go4GUI/TGo4ViewPanel.cpp, line 1870:

  fxRooteditor->SetResizeOnPaint(kFALSE); // disable internal resize on paintEvent
  fxRooteditor->SetEditable(); // mainframe will adopt pad editor window
  fxPeditor = TVirtualPadEditor::LoadEditor();
  fxPeditor->SetGlobal(kFALSE);
  fxRooteditor->SetEditable(kFALSE); // back to window manager as root window

  TGedEditor* ed = dynamic_cast<TGedEditor*>(fxPeditor);
  gTQSender = GetCanvas(); // canvas from the same panel
  ed->SetModel(GetActivePad(), obj, kButton1Down);

Here fxRooteditor is QRootWindow, which you can create inside any QWidget element.

Regards,
Sergey

Thanks for the input. Pity that both Qt-editions in ROOT source have more or less withered away, this especially looks mature. I had pretty much neglected QtGSI since even today the ROOT user guide writes:

However now that I took a look at the code in ROOT’s repository, it looked Qt4-ready already and making it build with Qt5 (commenting out some of the trickiest parts) was quite easy…

Hi,

QtRoot version in our repository supports both Qt4 and Qt5.
There are some ROOT features which should be better disabled when used with QtRoot interface
like gEnv->SetValue(“Canvas.ShowGuideLines”, 0);

Is there any chance that this version will be mainlined in the future? I have some difficulties making my colleagues accept software from third-party repositories… Thanks

Good question.

At the moment when qtgsi was introduced to ROOT (~10 years ago),
difference was not that big - probably only handling of TGedEditor was (still?)
not provided in ROOT version. As I could see, since then no big changes
were done in qtgsi code in ROOT repository.

In our version we add (and modify) a lot, introducing extra signals or adjusting for Qt4/Qt5.
Or just removing unnecessary classes like TQCanvasMenu. Therefore it will be difficult just
replace old code with ours without braking backward compatibility.

Also my experience says that we always need application-specific ‘hooks’ in QtRoot classes,
making for us difficult to use ‘frozen’ version from ROOT.

Regards,
Sergey

One aspect on merging the current GSI Qt code into ROOT is license difference: ROOT is LGPL, GSI Qt seems to be GPL. Yes there’s MathMore already, but components with license exceptions are perhaps not desired especially for parts that get little attention anyway like Qt-code.

I guess, if QtRoot authors agreed to include it in ROOT under LGPL license,
than I see no problem to publish its derivation under the same license.
But problem not in license but in many changes that we did in last 10 years.
I just read our logs - some classes were deleted while we do not require them.

QtRoot seems ambiguous, so to clarify the discussion: QtRoot has at least the following meanings depending on the context:
[ul]
[li] Sourceforge QtRoot by V. Fine[/li]
[li] QtRoot included in ROOT repository (different from QtGSI), which is based on the QtRoot by Fine.[/li]
[li] QtRoot of QtGSI, which, based on quick look, is totally different from aforementioned ones.[/li][/ul]
Is this correct?

I don’t see why the changes would be an obstacle given that ROOT’s QtGSI is hardly much used and even if the current code would need to be kept as such, it could be handled in various ways e.g. by build config. But I’m not sure are we talking about the same thing here: QtGSI in ROOT is a tiny library with only 7 rather small classes.

We are speaking about original GSI QtRoot code, used in our go4 framework.
There are difference in prefixes for class names,
but it was mostly the same code when add
to ROOT repository 10 years ago.