Problem using ROOT in a Qt application

Hi,
I use Qt Root capabilities in a Qt application program. My Root version is 4.04/02 compiled with the configuration: “linux --enable-qt --enable-table”.
My problem is the following: When I press the mouse right button in any Root object int the TQtWidget Canvas, what I see is a blank rectangle instead of the usual pop-up option’s window. After that, the pop-up window can not be removed and I can not set any option using the Gui interface.
Do you know why is this happening?
bye,
Alberto

I am begging a pardon for the typo in the installation instruction I made. One needs to set QTROOTSYSDIR variable rather QTROOTSYS. and it MUST define the absolute path

Yoou should try:

[code]cvs -d :pserver:cvsuser@cvs.bnl.gov:/data01/CVS login
password: cvsuser
cvs -d :pserver:cvsuser@cvs.bnl.gov:/data01/CVS co -d QtRoot root
cd QtRoot

To install QtRoot into your current ROOT area do

setenv QTROOTSYSDIR $ROOTSYS

You can choose to select the other directory for the QTROOT staff

However you will be required to adjust your LD_LIBRARY_PATH var.

qmake qtRoot.pro

or

qmake qtRoot.pro “CONFIG+=debug”

to get a debug build

make install[/code]
Can you try that and let me know whether it helps?
Thank you :blush: :blush:

Hi Fine,
I have done what you said with no compilation problems and no changes in my problem ( :cry: :cry: ). Do I need to recompile the whole ROOT or it is enough with what you said?
I still having grey windows instead of the usual ROOT preferences gui windows.
I use this settings to “properly” run ROOT in my Qt application:


# GUI specific settings.
Gui.Backend:                qt
Gui.Factory:                qt

Thanks.

[quote=“delaossa”]Hi Fine,
tead of the usual ROOT preferences gui windows.
I use this settings to “properly” run ROOT in my Qt application:


# GUI specific settings.
Gui.Backend:                qt
Gui.Factory:                qt

Thanks.[/quote]

No, it is not you need
:smiley:

You need

   Gui.Backend:                qt
   Gui.Factory:                 qtgui
   Plugin.TGuiFactory: qtgui   TQtGUIFactory  QtGui       "TQtGUIFactory()"

Plerase try to chage yiur ".rootrc and let me know

Hi,
Now It works much better, but not properly.
The pop-up windows of objects options work (now, they are not blank windows) and you can set some options like axis range, grid and ticks, but when you select for example “set line attributes” it launchs a bad operating window where you can not change anything. All the fields in the windows are in grey and don’t work.
What do you think?

Thanks!!

Hi again,
When I run root with the qt options in .rootrc I have a warning message which has to do with the symbol fonts. I don’t think that this was important but… who knows? maybe it is the guilty of not displaying the windows properly

[cafpe10]:/Qscan>root
** $Id: TGQt.cxx,v 1.99 2005/06/23 21:57:21 fine Exp $ this=0x891d578
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
 Dataset C++ base class library:
 $Id: TDataSet.cxx,v 1.8 2005/02/11 18:40:08 rdm Exp $
 Copyright(c) 1997~2002  [BNL] Brookhaven National Laboratory, Valeri Fine  (fine@bnl.gov). All right reserved
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   4.04/02       7 June 2005   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

Compiled for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.15.169, Mar 14 2005
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0]                                                    

:open_mouth: :open_mouth:

thanks again.

[quote=“delaossa”]Hi,
Now It works much better, but not properly.
The pop-up windows of objects options work (now, they are not blank windows) and you can set some options like axis range, grid and ticks, but when you select for example “set line attributes” it launchs a bad operating window where you can not change anything. All the fields in the windows are in grey and don’t work.
What do you think?

Thanks!![/quote]

I think you need the entire Qt extension not just QtGui.
In fact you had compiled everything. What you need is just the “proper” “.rootrc”

root.bnl.gov/QtRoot/QtRoot.html#switch
root.bnl.gov/QtRoot/root/root.di … nix.rootrc

However :frowning: . Even though Ged editor will work, it has not been completed yet. You are welcome to provide your contribution :smiley:
Seriously, I think you should build and study some examples under qtRoot/qtExamples
First of all see ex1. The source code is 112 lines long (including the comments)

[ul]look up qtRoot/qtExamples/ex1/qtrootexample1.ui.h
start “qdesigner” there

build and execute that project with Qmake[/ul]

qmake make

I would advice to look up the ual.bnl.gov project also.

Hi,
I have tried with this .rootrc root.bnl.gov/QtRoot/root/root.di … nix.rootrc
and It doesn’t work… :cry:

I have also tried to run the example you told me, but I don’t have ‘qdesigner’ command in my system.

thanks!

[quote=“delaossa”]Hi,
I have tried with this .rootrc root.bnl.gov/QtRoot/root/root.di … nix.rootrc
and It doesn’t work… :cry:
thanks![/quote]

WHY :open_mouth: :astonished: Give me futher information (probably via E-mail) :exclamation:
What did you get ? :question:

[quote=“delaossa”]Hi,
I have also tried to run the example you told me, but I don’t have ‘qdesigner’ command in my system.

thanks![/quote]

Sorry :frowning: just “designer” no “q” :slight_smile:

Well… It doesn’t work in the sense I told you: Some option’s windows are not displayed properly (I think what you call Ged editor, where you can set line and marker styles etc.). There are not output error or warning messages and I don’t know what kind of details I can send you.
Are you sure those windows has to work properly with that .rootrc?

On the other hand I can not run the example qtRoot/qtExamples/ex1/qtrootexample1.ui.h because I don’t know what to do in the designer program (it is a qt development tool which I have never used.) and I have a warning when I do ‘qmake’ and an error when I do ‘make’. :cry: :cry:

thanks!

Send me the the snapshot of the widgets you think are not correct as an attachment, for example

Hmm :blush: . I already said above

However, I want to make sure we are speaking about one and the same thing. Please send me the snapshot.

May I advice ? Please, spend a 30 min of your precisios time and study this tool
doc.trolltech.com/3.3/designer-manual.html
root.bnl.gov/QtRoot/QtRoot.html#designer

It will spare you hours and hours of E-mail conversation with ROOT team

As soon as you are using Qt, the Qt designer is a first kind of tool you should study

Just follow the Web page
doc.trolltech.com/3.3/designer-manual-2.html
The exersise should take about 30 min or less.

Anyway the trouble the “Pad Editor” is very new ROOT tool. The missed options of the “Pad Editor” will be fixed (soon)

[quote=“delaossa”]
I have a warning when I do ‘qmake’ and an error when I do ‘make’.
thanks![/quote]
Which error :unamused: Can you show me your error ](*,)

Hi Valeri,
Sorry for the delay in my answer, I was moving from my home University in Granada (Spain) to the IST of Lisboa.
I attach here a snapshot of my screen showing the bad operating window (the one to the left).
Respect to the use of Qt designer, I have to learn, but at the moment I am still programing qt applications directly from source. I am developing a Qt based program which was started without using Qt designer. Thank you for your help anyway it will be usefull when I try to run the QtRoot examples. On the other hand, doing nothing with Qt designer I tried ‘qmake’ and this is the error:

[dagda]:/ex1>qmake
Project MESSAGE: The rootlibs.pr was not found
[dagda]:/ex1>locate rootlibs.pr
/home/delaossa/local_cafpe10/cern/root_v4.04.02b/include/rootlibs.pri
/home/delaossa/local_cafpe10/cern/QtRoot/qt/inc/rootlibs.pri

thank you for your help!

Alberto


Thank you very much for your snapshot.
It indicates you did not use Qt extension yet.

Then it should be not too trouble for you to look up the 112 lines of the example code to see how TQtWidget shoulc be used. :slight_smile:
It does not matter at this point the code was produced with Qt “designer” assistance.

This strange :unamused:
See: root.cern.ch/viewcvs/qt/inc/rootcint.pri
There was typo introduced on

Tue Jun 28 13:21:39 2005 UTC

and fixed on

Tue Jun 28 22:55:18 2005 UTC

root.cern.ch/viewcvs/qt/inc/root … 1.1&r2=1.2

I was told the typo did not affect any “ROOT release”

May be you should file a formal LCG bug report to fix the CERN version

[ul]There is a simple workround though.
-Look up the qmake project file ex1/tqrootexample.pro

  • make a local copy of “typo” free version of rootcint.pri file (for example from the Qt extension distribution or from ROOT CVS
  • find there the line
inlcudeFile = $(ROOTSYS)/include/rootcint.pri

and replace it with

inlcudeFile = rootcint.pri

[/ul]

This should help. Please let me know aboiut the outcome asap.

[quote=“delaossa”]Hi,
I use Qt Root capabilities in a Qt application program. My Root version is 4.04/02 compiled with the configuration: “linux --enable-qt --enable-table”.
My problem is the following: When I press the mouse right button in any Root object int the TQtWidget Canvas, what I see is a blank rectangle instead of the usual pop-up option’s window. Alberto[/quote]
I hope I’ve found and fixed the bug. Thank you for your report.

[code]Index: src/TGQt.cxx

RCS file: /user/cvs/root/qt/src/TGQt.cxx,v
retrieving revision 1.22
diff -u -r1.22 TGQt.cxx
— src/TGQt.cxx 8 Jul 2005 06:43:09 -0000 1.22
+++ src/TGQt.cxx 12 Jul 2005 23:17:50 -0000
@@ -1375,7 +1375,7 @@
} else{
devSize = thisWidget.geometry();
}

  •        devSize.moveTopLeft(thisWidget.mapToGlobal(thisWidget.pos()));
    
  •        devSize.moveTopLeft(thisWidget.mapToGlobal(QPoint(0,0)));
        } else {
           devSize = GetQRect(*dev);
        }[/code]

Hi Valeri,
Sorry for this big delay in my answer. I took hollydays.
I have seen your last post and I have downloaded from CVS the last QtRoot version, where I expected to have the TGQt.cxx corrected. After that I have reinstalled QtRoot in my $ROOTSYS with no problem.
The problems begin when I try to run my program. This is the output:

[code]g++ Qscan.o QScanApplication.o PaletteWindow.o libicadisp.a /home/delaossa/liqAr/fullreco/libFullReco.a -L/usr/lib/qt-3.3/lib -lqt-mt -L/usr/lib/mysql -lmysqlclient -lg2c -L/cern/pro/lib -lmathlib -lphtools -lkernlib -L/cern/CLHEP/lib -lnsl -lcrypt -ldl -lpacklib -lg2c /home/delaossa/liqAr/Libraries/libqwt.a -ljpeg -lpng -lm -L/cern/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -pthread -lm -ldl -rdynamic -lMinuit -lGeom -L/cern/QtRoot/lib -L/cern/root/lib/ -lGui -lGQt -lQtGui -lQGLViewer -o Qscan
[dagda]:/Qscan>Qscan &
[2] 4592
[dagda]:/Qscan>QPaintDevice: Must construct a QApplication before a QPaintDevice

[2] Exit 1 Qscan
[dagda]:/Qscan>
[/code]
And exactly the same happends when I try tu run the example “ex1” in qtExamples:

[code]g++ -o tqrootexample .obj/main.o .obj/qtrootexample1.o .obj/qmake_image_collection.o .obj/moc_qtrootexample1.o -L/usr/lib/qt-3.3/lib -L/usr/X11R6/lib -L/cern/root/lib -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lGui -pthread -ldl -rdynamic -lTable -lGQt -lQtGui -lqt-mt -lXext -lX11 -lm -lpthread
[dagda]:/ex1>tqrootexample &
[1] 4643
[dagda]:/ex1>QPaintDevice: Must construct a QApplication before a QPaintDevice

[1] Exit 1 tqrootexample
[dagda]:/ex1>
[/code]
This is strange, isn’t? What do you think?
When I build my program without the QtGui library then it works, but not properly (in the same sense of always).

Thank you very much!

Hi again,
In the previous post I said

and I have realized that is not true. Now, without linking my program with -lQtGui it works properly! As well as the example HelloCanvas in QtRoot, which doesn’t make use of this library. The problem persist only when you use -lQtGui like in the example ex1.
Thanks!

[quote=“delaossa”]Hi again,
Now, without linking my program with -lQtGui it works properly!
[/quote]

This is still strange I did not see this before. My impression :unamused: for some reason since 4.04 ROOT became multithreaded :frowning: . However I did not see any annouce about that. :question:
That may have caused some legacy initialization order does not follow the program flaw anymore. I have to study that :blush: