Qtroot and qt4

Hello,

I’m having some trouble using the QTROOT module, which I’m testing with qt4 (it’s working fine with qt3).

  1. when using “–enable-qt” in the ROOT configure command, I see:
    Checking for qt.h … no
    Checking for libqt-mt, libqt, qt-mt*, qt-mt334, qt-mt335, qt-mt336, or qt … no
    It’s looking for the qt3 libraries. Main result is, qtroot won’t be compiled (so I don’t have libGQt)
  • EDIT: this problem went away… someone patched it with the latest 5.16?
  • EDIT2: the include files for qtroot are now in the right place… someone patched it with the latest 5.16?
    I was using 5.16 as of yesterday, apparently someone changed it?
  1. I tried to compile the code anyway, up to the linking part. I had to modify TQtWidget.h as follows:
    • remove the “resize” calls (lines 78, 240)
    • remove Qt::WStyle_NoBorder (I think it’s no longer supported), line 102.

As of 2), please let me know if I did the right thing.

best regards,
mauri

Update:

Now the configure command recognize that I’m running qt4.3.1.
But ROOT stops at QTROOT when compiling:

it looks for headers that are not there, there’s a name mismatch:
qdragobject.h is not there, but q3dragobject.h is
qpopupmenu.h is not there, but q3popupmenu.h is.

basically all names in $QTDIR/include/Qt3Support starts with “q3” instead of “q”.

I tried linking all those files, but then I get this problem:
/opt/programs/qt/include/Qt3Support/qpopupmenu.h: In member function ‘int Q3PopupMenu::exec()’:
/opt/programs/qt/include/Qt3Support/qpopupmenu.h:55: error: ‘findIdForAction’ was not declared in this scope
/opt/programs/qt/include/Qt3Support/qpopupmenu.h: In member function ‘int Q3PopupMenu::exec(const QPoint&, int)’:
/opt/programs/qt/include/Qt3Support/qpopupmenu.h:57: error: ‘findIdForAction’ was not declared in this scope
include/TQRootDialog.h: At global scope:
include/TQRootDialog.h:47: error: invalid use of undefined type ‘struct QVBox’
include/TQRootDialog.h:40: error: forward declaration of ‘struct QVBox’
include/TQRootDialog.h:56: error: ‘WFlags’ has not been declared

any help appreciated.

Hi Mauri,

Please check your setting:

  • QTDIR (should be set to your qt4.3.1 directory);
  • LD_LIBRARY_PATH (should contain $QTDIR/lib);
  • PATH (should contain $QTDIR/bin).
    If all settings are OK, try with:make distclean-qt distclean-qtroot make all-qt all-qtrootand let us know if the errors persist.

Cheers, Ilka

Dear Ilka,

thanks for the reply.
My settings are correct.

When I run your suggested commands:

make distclean-qt distclean-qtroot
make all-qt all-qtroot

qtroot compiles fine (thanks!).

I still have problems when I type “gmake” in the root directory though: it stops at the same place as before (see below). Now the question is: does the root compilation end with qtroot? If that’s the case, I’m ok. But if other packages are to be compiled after, then this error prevents it.

thanks for all the help,

mauri

Note: my qt is compiled with:
./configure -qt-gif -no-cups -no-qt3support -prefix $QTDIR -qt-sql-mysql -no-exceptions

Note: my root is compiled with:
./configure linuxx8664gcc --enable-shared --enable-opengl --disable-krb5 --disable-ldap --enable-soversion --enable-qt --enable-mathcore --enable-mathmore --enable-minuit2 --with-cern-libdir=$CERN_LIB --with-mysql-incdir=$MYSQL/include --with-mysql-libdir=$MYSQL/lib --with-qt-libdir=$QTDIR/lib --with-qt-incdir=$QTDIR/include

the error is in qtsgi:

  1. it tries to find the .h inside qt/include/Qt3Support. I Had to link the q3 incs to those (example: q3popupmenu.h to qpopupmenu.h).
  2. include/TQRootDialog.h: At global scope:
    include/TQRootDialog.h:47: error: invalid use of undefined type ‘struct QVBox’
    include/TQRootDialog.h:40: error: forward declaration of ‘struct QVBox’
    include/TQRootDialog.h:56: error: ‘WFlags’ has not been declared
    qtgsi/src/TQCanvasMenu.cxx: In constructor ‘TQCanvasMenu::TQCanvasMenu(QWidget*, TCanvas*)’:
    qtgsi/src/TQCanvasMenu.cxx:39: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx: In constructor ‘TQCanvasMenu::TQCanvasMenu(QWidget*, QWidget*, TCanvas*)’:
    qtgsi/src/TQCanvasMenu.cxx:51: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx: In destructor ‘virtual TQCanvasMenu::~TQCanvasMenu()’:
    qtgsi/src/TQCanvasMenu.cxx:62: warning: possible problem detected in invocation of delete operator:
    qtgsi/src/TQCanvasMenu.cxx:62: warning: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: warning: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx:62: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined.
    qtgsi/src/TQCanvasMenu.cxx: In member function ‘void TQCanvasMenu::Popup(TObject*, double, double, QMouseEvent*)’:
    qtgsi/src/TQCanvasMenu.cxx:113: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx:119: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx:121: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx:126: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’
    qtgsi/src/TQCanvasMenu.cxx:135: error: invalid use of undefined type ‘struct QPopupMenu’
    include/TQCanvasMenu.h:39: error: forward declaration of ‘struct QPopupMenu’

Hi Mauri,

ROOT offers two different interfaces to Qt as described at ftp://root.cern.ch/root/doc/26ROOTandQt.pdf

According to the information you have provided my guess is that you want to use Qt BNL. In this case you should not have qtgsi involved if you have used --enable-qt in ./configure. So, you may need to run make distclean to clean-up your root version.

Cheers, Ilka

Hi Ilka,

I managed to compile everything by disabling qtgsi (not that it’s enabled by default if I use the --with and QT).

To compile my software, I still need to make the modifications below:

Right now my software compiles, I’m debugging the running and will let you know how it goes. Thanks again for your precious help!.

mauri

Hi Mauri,

You are welcome. I will send an e-mail to Valeri Fine, our Qt BNL expert, pointing out this topic. He will help you in case you need more help.

Best regards, Ilka

[quote=“ungaro”]* EDIT: this problem went away… someone patched it with the latest 5.16?

  • EDIT2: the include files for qtroot are now in the right place… someone patched it with the latest 5.16?
    I was using 5.16 as of yesterday, apparently someone changed it?
    [/quote]

Hello Mauri,

The Qt4 support was introduced with ROOT 5.16 only.
The “configure” script of the previous ROOT < 5.16 was not “training” to recognize Qt 4.x

[quote=“ungaro”]
. . .
My settings are correct.

When I run your suggested commands:

make distclean-qt distclean-qtroot
make all-qt all-qtroot

qtroot compiles fine (thanks!).

I still have problems when I type “gmake” in the root directory though:
mauri[/quote]
You do not need any :bulb: “qmake” to create the Qt-layer. ROOT “configure” + ROOT “make” should be sufficient to do the job.

Oppps :blush: you were speaking about GMAKE :open_mouth: rather QMAKE :unamused: . Please disregard my remark above.

The original version of Qt-layer was done with :exclamation: Qt3Support.
Even though I made recently some effort to get rid of the qt3support I am afraid some depedency of that “porting” library still there.
At least I did not test :blush: the Qt-layer against of the Qt 4.x that is built with -no-qt3support flag

By this reason you are advised to remove the flag in question and rebuild Qt 4.3 and the “qt” related ROOT shared libraries. . It does not harm your Qt 4.x installation. It just add the extra shared library and some header files to facilitate the Qt 3.x to Qt 4.x port.

[quote=“ungaro”]the error is in qtsgi:
[/quote] Ilka had mentioned that qtsgi is an alternative way to use ROOT within the Qt applications.

I would like to call your attention that QtGSI interface is provided with QtRoot-extension package from BNL (see: root.bnl.gov/QtRoot/htmldoc/TQRootCanvas.html ).

The example
root.cern.ch/viewcvs/qtgsi/test/ working with no qtgsi package from ROOT CVS installed.

In the other words the qtgsi-based applications should be compatible and work with QtRoot also.

[quote=“ungaro”]
. . .
2) I tried to compile the code anyway, up to the linking part. I had to modify TQtWidget.h as follows:
* remove the “resize” calls (lines 78, 240)
* remove Qt::WStyle_NoBorder (I think it’s no longer supported), line 102.
As of 2), please let me know if I did the right thing.
[/quote]I am begging a pardon replying your request by “small portions”.
Thank you very much for your valuable feedback.

Let me call your attention again that you may not have faced these problems if you build your Qt without the “-no-qt3support” flag. I would insist one should not use “no-qt3support” Qt 4.x build flag unless ROOT supports both Qt flavours.

In fact I see no big reason to use the non-default Qt build options like

-qt-gif -no-cups -no-qt3support -no-exceptions yet.

We have to keep supporting the code to be compatible with both animals namely Qt3 and Qt4. We have to have qt3support in place to escape the TWO concurrent codes developing hassle.

What about your concrete corrections. They can not be accepted “as is” because they make the code not backward comatible with Qt3.[quote=“ungaro”] * remove the “resize” calls (lines 78[/quote]
The correct Qt3/Qt4 compatible way to fix the line 78 you mentioned above can be found:
star.bnl.gov/cgi-bin/cvsweb. … 2=1.10;f=h

[quote=“ungaro”] * remove the “resize” calls (lines 78, 240)[/quote]I did not find any “resize” issue with the line 240 yet.

[quote=“ungaro”]

  • remove Qt::WStyle_NoBorder (I think it’s no longer supported), line 102.[/quote]
    This correction sounds strange for me.
    Since you built your Qt with “no-qt3support” flag, you should not see any base class QWidget(parent, name,f) ctor with THREE parameters. Qt 4.x has this class ctor with TWO parameters only. The omitted parameter is the “class name” rather the “widget flag”. Please, compare doc.trolltech.com/4.3/qwidget.html

This means the safe approach is to replace the default Qt::WStyle_NoBorder with ZERO and change the TQtWidget.cxx:129 to replace QWidget(parent,name,f) with QWidget(parent,f)

I am keep to see your test result and welcome your comments and corrections.
Thank you.

Dear Valeri,
thanks for all these suggestions.

I had a typo in the my previous post here. In fact, my qt was built with qt3 support (w/o that flag). But I will rebuilt it again to make sure.

I will address each of your points, and will get back to you very soon (probably tomorrow) Thanks for all the help!

mauri

[quote=“ungaro”]Hello,
2) I tried to compile the code anyway, up to the linking part. I had to modify TQtWidget.h as follows:
* remove the “resize” calls (lines 78, 240)
mauri[/quote]Hello Mauri. Thank you very much for remarks. Your comments about lines 78 and 240 are correct. I found the fix I provided is not sufficient :blush: but … by some reason my compiler did not alert me :open_mouth: . The code was compiled and the tests did work.
I think to be Qt3 / Qt4 compatible it should be done like this
star.bnl.gov/cgi-bin/cvsweb. … y=date;f=h
I would appreciate a lot you test this solution with your Qt4 installation and let me know the outcome.

Dear Valeri,

I recompiled qt with qt3 support to make sure it’s there.
I’m also recompiling ROOT with the changes you pointed out in TQtWidget.h.

I’ll let you know the outcome soon.

By the way, the --disable-qtgsi is overridden by the --with-qt-libdir=$QTDIR/lib
–with-qt-incdir=$QTDIR/include flags, that enable both qt and qtgsi. So, basically:

–enable-qt is not needed if --with-qt are there
–disable-qtgsi won’t work unless its typed AFTER the -with-qt flags.

Just an heads up.

cheers,
mauri

Dear Valeri,

compilation successful with your changes.

Note however that I still had

error: ‘WStyle_NoBorder’ is not a member of ‘Qt’

So I replaced it with Qt::FramelessWindowHint as suggested by the qt people doc.trolltech.com/4.3/qt.html#WindowType-enum (they say WStyle_NoBorder is obsolete).

By the way, I do not see any difference in benchmarks with qt enabled or disabled. Both are at about 1450 ROOTMARKS.

cheers,
mauri

Hello Mauri.

[quote=“ungaro”]Dear Valeri,

compilation successful with your changes.
[/quote]
Thank you very much for your information.

[quote=“ungaro”]Note however that I still had

error: ‘WStyle_NoBorder’ is not a member of ‘Qt’

So I replaced it with Qt::FramelessWindowHint as suggested by the qt people doc.trolltech.com/4.3/qt.html#WindowType-enum (they say WStyle_NoBorder is obsolete).
[/quote]I already explained that constant is Qt4 specific and it can not be used as soon as Qt3/Qt4 compatibility is concern. On the other hands “FramelessWindow” is NOT what we really need. We want to see here the original Qt “default” value what-ever that default is. One should use “ZERO” instead for Qt3 and Qt4 env. See
star.bnl.gov/cgi-bin/cvsweb. … y=date;f=h
I’ll test this and then propage to CERN.[quote=“ungaro”]By the way, I do not see any difference in benchmarks with qt enabled or disabled. Both are at about 1450 ROOTMARKS.[/quote]Great. (By the way, how you know whether the Qt plugin was really loaded? ) Thank you very much for your number. I am wondering if you got it with your local desktop env. May I ask you to test it again from the remote X-terminal?

Hello Mauri,
I believe I found :bulb: the reason for your compilation troubles.
The point is to get Qt3Support it is not sufficient to install Qt 4.x with no “-no-qt3support” flag.
One has to provide -DQT_QT3SUPPORT_LIB -DQT3_SUPPORTCPP flags at compile time also. I had these flags set globaly by default. By this reason I did not see any problem. I bet you had no this flags by some reason.

I have fixed this issue with qt/Module.mk makefile
star.bnl.gov/cgi-bin/cvsweb. … r2=1.3;f=h
The fix will be propagated to CERN by Monday.

Thank you.