Problem with QTRoot

Hi Rooters

I am trying to build a “ROOT-based QT application” and I have some problems.
I am using a Linux box ( Redhat 8 ). On this platform, the QT package is pretty old (version 3.0.5) so I installed QT3.3.4 into my home directory and buit it with the following options: -debug -qt-gif -thread -no-xft -no-exceptions . I also have added in my .cshrc file the QTDIR variable and updated the $PATH and $LD_LIBRARY_PATH to be sure that I would pick the right QT version.

I have also installed root_v4.04.02f (using the ROOTSYS variable for installation) with the following flags:
–enable-opengl --enable-shared --enable-thread --enable-sov
ersion --enable-qt --with-qt-incdir=${QTDIR}/include --with-qt-libdir=${QTDIR}/lib

But when I tried it, a couple of things are not running so smoothly.

  • Missing files:
    It looks like there is no rootcint.pri nor TQtWidget.cw in the production version (root_v4.04.02f ). Is that normal? I move then to the dev version using the same flags and noticed that the .pri and .cw are not copied with the “make install” command. I had to copy them by hand.

  • Fonts problem:
    Without a modified .rootrc, root starts correctly, and I have the message :
    “FreeType Engine v2.1.9 used to render TrueType fonts”.
    When I tried to swith to QT, using the .rootrc file as described in page 361 of the new ROOT Guide 4.04, I have the following message:
    ** $Id: TGQt.cxx,v 1.17.2.1 2005/07/11 17:03:24 rdm Exp $ this=0x8920250
    The font “symbol.ttf” was not installed yet. Substitute it with "Arial"
    Make sure your local “~/.fonts.conf” or “/etc/fonts/fonts.conf” file points to “$ROOOTSYS/fonts” directory to get the proper support for ROOT TLatex class.

  • Crashes when interacting with the widgets
    When using the qt backend, I noticed that very often interacting with the canvas is slower that with “native” root gui. Also when I right-click on the Canvas to get the DrawPanel method, the editor takes a long time to pop-up and sometimes doesn’t display anything (it stays grey). Interacting with the widgets in the editor make the system either freeze, either crash. I don’t have this problem when I turn off the qt backend.

  • Anti-aliasing.
    It simply doesn’t work. However, the true-types fonts have been turned-on automatically by the ./configure and the qt flag -no-xft has been used as indicated in the ROOT manual.

Is there something I am doing wrong? Is this possible that the qt version 3.0 my system uses (since I am working under kde) and theqt version 3.3.4I have installed for ROOT backend are interacting and causing me all those problems?

Thanks for your help

[quote=“matthieuguillo”]Hi Rooters
I am trying to build a “ROOT-based QT application” and I have some problems.
[/quote]

Thank you very much for your interest and detailing description of the problems you encountered.

This is correct

Correct

I think it is an omission of the qt/Module.mk makefile to be fixed. Thank you.

That’s an expected message. Since you installed Qt with “-no-xft”, Qt applies the fonts installed on your X-server (i.e. with your X-terminal).

To see what I mean try for example to move to some Windows-based server. The message above should disappear.

That’s the correct observation :frowning: . The ROOT GUI relies on some rather sophisticated X11 events those hard to mimic with Qt. That requires some corrections on ROOT GUI side and it is on “to do list”. The problem should not be visible for the embedded into the Qt application the TCanvas - that is primary goal of the project. Anyway you can get the correct behavior by installing the “Qt Extension” (see: root.bnl.gov/QtRoot/How2Install4 … #installqt )

[quote=“matthieuguillo”]

  • Anti-aliasing.
    It simply doesn’t work. However, the true-types fonts have been turned-on automatically by the ./configure and the qt flag -no-xft has been used as indicated in the ROOT manual.

Is there something I am doing wrong? Is this possible that the qt version 3.0 my system uses (since I am working under kde) and theqt version 3.3.4I have installed for ROOT backend are interacting and causing me all those problems?

Thanks for your help[/quote]

The “true-types” ROOT option does not affect your Qt installation. It affects the “native”. i.e. direct X11 layer only.

There is some dilemma here. Since you did not choose “xft” (by my advice) , you deliberately made the remote X-server rather Qt responsible for font anti-aliasing (see my comment above). Where is this advice comes from?

The problem is the ROOT was designed to make the Postscript output as close as possible to the screen fonts. It is possible with TTF fonts since the TTF glyphs aspect ratio match well with that from Postscript fonts. Unfortunately “xft” fonts, those are provided with Qt distribution, have the different aspect ratio. They are slightly wider. As result as soon as you install Qt with “xft” font you will get the nice anti-aliasing fonts (some performance penalty should be anticipated) but the postscript output (via ROOT TPostscript class) will be ugly.

Now you can choose what you want yourself:

  1. Screen image that match well with the postscript but delegating the font anti-alising to your X-server. - use “-no-xft”
  2. Nice screen font on any X-server but the ugly Postscript.
    apply “-xft” during Qt installation

Alas I did not yet whether one can resolve the dilemma.

[quote=“matthieuguillo”]Hi Rooters

  • Missing files:
    It looks like there is no rootcint.pri nor TQtWidget.cw in the production version (root_v4.04.02f ). Is that normal? I move then to the dev version using the same flags and noticed that the .pri and .cw are not copied with the “make install” command. I had to copy them by hand.

Thanks for your help[/quote]

This patch should fix the omission:

[code]Index: Makefile

RCS file: /user/cvs/root/Makefile,v
retrieving revision 1.190
diff -r1.190 Makefile
671a672,673

     $(INSTALLDATA) include/*.pri         $(DESTDIR)$(INCDIR); \
     $(INSTALLDATA) include/*.cw          $(DESTDIR)$(INCDIR); \[/code]

Thank you

Thanks Valeri

I have embedded the TQTWidget in my QT application and until now it is working fine. As you said, no graphic Editor for graph or histograms though :frowning: , I will have to to it myself for now.

Here are a few more questions:

  • When I start my application, on my shell I have Cint up and runnnig. I don’t have it in a QT-based ROOT application, only in a ROOT-based QT application. Cint is very confusing for someone who doesn’t know ROOT as most of my colleagues do not.

  • A lot of persons in my lab are very interested to have my application run on their Windows laptop. Is there any plan to make ROOT compatible with QT4 knowing that QT4 is open source (and QT3 is not)? Some headers files and shared libraries are different between the 2 versions of QT.

  • For ROOT-based QT applications, I think I don’t need cygwin on windows since QT handles the display and mouse interactions. Is there a place where it is explained how to build ROOT with QT layer (even QT3) on Windows platform? I went to Axel-Naumann page but found only with cygwin to handle X11 signals.

I believe that having ROOT and QT4 on Windows laptop will be very valuable to the whole ROOT community for data analysis on the go. Building a ROOT-based QT application is a real pleasure with “designer” as a GUI builder, that goes well beyond the GUI designer in ROOT.

Thanks a lot

One can find the uncompleted :frowning: yet the Qt-based implementation of ROOT graphical editor as a part of the Qt Extension package.
root.bnl.gov/QtRoot/QtRoot.html#what

If you are willing to devote your time to do something for yourself probably you may have spent it for the glory of the entire ROOT community :slight_smile: may not you :question: My CVS Repository is open for the contributions.

:unamused: I am wondering if there is some typo in your clause above. Did I understand you want to eliminate the CINT prompt?

Yes, I can do that (today :smiley: ). It will in fact simplify the application. :smiley:

On the other hand, I would like to call your attention to the qtRoot/qtExample/ex1 example. That shows how to use Qt QLineEdit
(see: doc.trolltech.com/3.3/qlineedit.html ) to enter the RootCint command from Qt GUI. In addition the class qtRoot/qtgui/inc/QtTabValidator.h allows you to add the RootCint aware command line completion to any your Qt text input control.

There are three separate problems, to be solved here

[ul]

1. Windows version of Qt layer. There is a Windows version of Qt layer for ROOT 4.00.08 and below (See root.bnl.gov). Unfortunately the ROOT interface so-called TWin32Old that implementation relied on was removed from the ROOT distribution last fall. One has to find a time (about 1-2 weeks) to adapt it to the current Windows implementation. (In past I did it during my vacation time, that is something I can not afford yet now)

2. Free Qt3 for Windows. If you buy the Qt3 book the book comes with CDROM that contains the “free” version of Qt3 3.2 for Windows (see: root.bnl.gov/QtRoot/QtRoot.html#free ).

3. Qt4 conversion. Qt4 comes with the qt3to4 utility ( see: doc.trolltech.com/4.0/qt3to4.html ) that converts the Qt3 text to Qt4 compliant text.
[/ul]

This suggests, it is not a big deal to convert the text at once. However, the converted text is no use under Qt3 anymore. This means one has to support two branches of Qt layer source code simultaneously, namely Qt3 and Qt4. This is something I cannot afford alone yet.
Certainly, I can not go to Qt4 because Qt3 is still the official Qt version for LHC collaborations.
If LHC decides to move on and to use Qt4, I may have switched to Qt4 as well.

The installation of Qt layer is explained
doc.trolltech.com/3.3/qmake-manual.html ) I believe one can follow that to install it under Windows as well. The problem will be with the ROOT version. As I have said above it is Ok for ROOT 4.00.08 and below.
You can download the binary version for Windows to see how it works
root.bnl.gov/QtRoot/downloads/root.4.00.08.exe. It is “one click Web installation”. just click that link and wait for < 5 min.

In theory one can install the x11 version of Qt and ROOT under cygwin using gcc and the X11 cygwin client. It should work. As soon as I know Axel did try sometimes ago this combination. May be you should ask him for further details.

I fully agree with your statement :stuck_out_tongue: . However the experiment I am working for, namely STAR ( star.bnl.gov ) , does not provide any support for Windows platform. That’s the obstacle.

By the way QtRoot works well on “native” Mac just, in case (The only problem with Mac it does not provide any RootCint prompt yet :blush: )

Hi Valeri

Thanks a lot for your answer, it will help me a lot. I will definitively spend more time on the BNL Qt page and lear about the extension they made.

If you are willing to devote your time to do something for yourself probably you may have spent it for the glory of the entire ROOT community.

I can do that. However, since my primary goal is for my colleagues, the interface may be slighlty different from the Editor found with the regular ROOT distribution. In any case I can send the sources to you.

I am wondering if there is some typo in your clause above. Did I understand you want to eliminate the CINT prompt?

Yes.

I will try the qtRoot/qtgui/inc/QtTabValidator.h example to undestand how to plug CINT in the application.
This can be most useful for advanced users. I will also try your suggestions on how to port on windows with QT4.

For MAC, I have the same problem that you have with Windows. Eventhough Mac OS X combines the power of Unix with an Office desktop, my lab doesn’t support it :cry: :cry: .

Thank agian
Regards

[quote=“matthieuguillo”]
I have embedded the TQTWidget in my QT application and until now it is working fine.
. . . .

  • When I start my application, on my shell I have Cint up and runnnig. I don’t have it in a QT-based ROOT application, only in a ROOT-based QT application. Cint is very confusing for someone who doesn’t know ROOT as most of my colleagues do not.
    . . . .
    Thanks a lot[/quote]

The patch below fixed the problem(it is aready in QtROOT CVS repository) . One can still get the ROOT prompt by providing an extra ROOT parameter via the custom “.rootrc” file

.rootrc: Gui.Prompt yes

[code]Index: src/TQtWidget.cxx

RCS file: /data01/CVS/root/qt/src/TQtWidget.cxx,v
retrieving revision 1.55
diff -u -r1.55 TQtWidget.cxx
— src/TQtWidget.cxx 12 Jul 2005 23:10:56 -0000 1.55
+++ src/TQtWidget.cxx 4 Aug 2005 19:16:04 -0000
@@ -18,6 +18,7 @@
#include “TQtTimer.h”

#include “TROOT.h”
+#include “TEnv.h”
#include “TRint.h”
#include “TSystem.h”
#include “Getline.h”
@@ -123,12 +124,14 @@
setWFlags(getWFlags () | Qt::WRepaintNoErase | Qt:: WResizeNoErase );
setBackgroundMode(Qt::NoBackground);
if (fEmbedded) {

  • static int argc;
  • static int argc =0;
    if (!gApplication) {
    argc = qApp->argc();
  •    TRint *rint = new TRint("Rint", &argc ,qApp->argv());
    
  •    TRint *rint = new TRint("Rint", &argc, qApp->argv(),0,0,kTRUE);
       // To mimic what TRint::Run(kTRUE) does.
    
  •    Getlinem(kInit, rint->GetPrompt());
    
  •    const char *prompt= gEnv->GetValue("Gui.Prompt", (char*)0);
    
  •    if (prompt)
    
  •        Getlinem(kInit, rint->GetPrompt());
       TQtTimer::Create()->start(0,TRUE);
    
    }
    Bool_t batch = gROOT->IsBatch();
    [/code]

[quote=“matthieuguillo”]Hi Rooters

I am trying to build a “ROOT-based QT application” and I have some problems.
. . .

  • Fonts problem:
    Without a modified .rootrc, root starts correctly, and I have the message :
    “FreeType Engine v2.1.9 used to render TrueType fonts”.
    When I tried to swith to QT, using the .rootrc file as described in page 361 of the new ROOT Guide 4.04, I have the following message:
    ** $Id: TGQt.cxx,v 1.17.2.1 2005/07/11 17:03:24 rdm Exp $ this=0x8920250
    The font “symbol.ttf” was not installed yet. Substitute it with "Arial"
    Make sure your local “~/.fonts.conf” or “/etc/fonts/fonts.conf” file points to “$ROOOTSYS/fonts” directory to get the proper support for ROOT TLatex class.
    [/quote]
    The problem you had mentioned above are to be resolved with Qt-layer compiled and built against of Qt 4.3.x and higher.
    . . .

With Qt 4.x no performance degradation due using the high quality anti-aliased XFT fonts were observed yet. By this reason no special version of Qt 4.3.x and special build flag to customize the Qt is required. It was not the case with Qt 3.x

[quote=“matthieuguillo”]Thanks Valeri

  • A lot of persons in my lab are very interested to have my application run on their Windows laptop. Is there any plan to make ROOT compatible with QT4 knowing that QT4 is open source (and QT3 is not)? Some headers files and shared libraries are different between the 2 versions of QT.

. . .

I believe that having ROOT and QT4 on Windows laptop will be very valuable to the whole ROOT community for data analysis on the go. Building a ROOT-based QT application is a real pleasure with “designer” as a GUI builder, that goes well beyond the GUI designer in ROOT.
[/quote]
The “experimental” version of the Qt-4.3.x-based port of the Qt-layer and Qt Extensions is available to download from BNL CVS repository (see: root.bnl.gov). To use it one should first install Qt 4.3.x or higher with Visual C++ (see the Web pages:
sourceforge.net/projects/qtwin
and
wiki.qgis.org/qgiswiki/Building_ … l_C++_2005 )