Qt4 with Root 5.20

I used the script from root.bnl.gov/QtRoot/INSTALL_QTROOT.sh given in this thread:
root.cern.ch/phpBB2/viewtopic.ph … hlight=qt4
to install root with qt extensions. This installs by default, Root V5.18. Is there a way to change it to install the latest (V5.20)?
Thanks,
dsmcc.

QT4 is the default in the standard CERN distributions since version 5.21.
Could you try with our binaries or source from our download page?

Rene

Hi,
I was using Qt3 all these days and now am switching to qt4. I have a small application designed by QT designer (QT4) with a TCanvas (by promoting QWidget to TQWidget) in it.
The program compiles and everything works fine but when I close the application, there is a segmentation fault followed by a series of errors (most of them point to TCanvas and ~TQtWidget). The application without TCanvas does not show this behaviour. Should I do some “clean up” of the TQtWidget before closing?. If so how and where? . I never had this problem in Qt3.
The errors:
*** Break *** segmentation violation
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
Attaching to program: /proc/24853/exe, process 24853
done.
done.
[Thread debugging using libthread_db enabled]
[New Thread -1209010496 (LWP 24853)]
done.
done.
done.
done.
0x0068b7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x03337f13 in __waitpid_nocancel () from /lib/tls/libc.so.6
#2 0x032e17b9 in do_system () from /lib/tls/libc.so.6
#3 0x039ba98d in system () from /lib/tls/libpthread.so.0
at unix/src/TUnixSystem.cxx:1879
#5 0x00c4f252 in TUnixSystem::StackTrace (this=0x9d96fd0) at unix/src/TUnixSystem.cxx:2067
#6 0x00c4d097 in TUnixSystem::DispatchSignals (this=0x9d96fd0, sig=kSigSegmentationViolation) at unix/src/TUnixSystem.cxx:1027
#7 0x00c4b2bd in SigHandler (sig=kSigSegmentationViolation) at unix/src/TUnixSystem.cxx:351
#8 0x00c51faa in sighandler (sig=11) at unix/src/TUnixSystem.cxx:3290
#9
#10 0x046993c0 in __dynamic_cast () from /usr/lib/libstdc++.so.6
#11 0x009af73b in IsWidget (d=0xffffffff) at src/TGQt.cxx:110
#12 0x009b70e5 in TGQt::SetDoubleBuffer (this=0x9fc07e8, wid=2, mode=1) at src/TGQt.cxx:2087
#13 0x001466ac in TCanvas::SetDoubleBuffer (this=0x9f84318, mode=1) at gpad/src/TCanvas.cxx:1741
#14 0x001438ae in TCanvas::FeedbackMode (this=0x9f84318, set=false) at gpad/src/TCanvas.cxx:947
#15 0x00142906 in TCanvas::Close (this=0x9f84318, option=0x1b001a “”) at gpad/src/TCanvas.cxx:667
#16 0x00142512 in TCanvas::Destructor (this=0x9f84318) at gpad/src/TCanvas.cxx:568
#17 0x001422d1 in ~TCanvas (this=0x9f84318) at gpad/src/TCanvas.cxx:537
#18 0x009cb246 in ~TQtWidget (this=0x9e20438) at src/TQtWidget.cxx:250
#19 0x0804b5d5 in First::~First ()
#20 0x0804bbc7 in main ()
Thanks,
dsmcc.

Could you clarify which version of ROOT you are using?
If from BNL, see with the BNL mailing list. If CERN 5.21/06 could you send the shortest possible setup reproducing your problem?

Rene

Hi I am, using Root version 5.18 and Qt version 4.4.3. Well, what is that bnl mailing list?
Thanks,
dsmcc

see: lists.bnl.gov/mailman/listinfo/qt-root-l
The support for Qt4 in 5.18 was pretty bad.
QT4 is the only version of Qt supported by ROOT 5.21/06. You can download binaries from
root.cern.ch/root/Version521.html

Rene

[quote=“dsmcc”]#11 0x009af73b in IsWidget (d=0xffffffff) at src/TGQt.cxx:110 #12 0x009b70e5 in TGQt::SetDoubleBuffer (this=0x9fc07e8, wid=2, mode=1) at src/TGQt.cxx:2087 #13 0x001466ac in TCanvas::SetDoubleBuffer (this=0x9f84318, mode=1) at gpad/src/TCanvas.cxx:1741[/quote]I am awaiting your example to reproduce the issue. Mean time I have been trying to investigate the issue further. The trouble method is

void TGQt::SetDoubleBuffer(int wid, int mode) { if (wid == -1 && wid == kDefault) return; QPaintDevice *dev = iwid(wid); if ( TQtWidget *widget = (TQtWidget *)IsWidget(dev) ) widget->SetDoubleBuffer(mode); } and I did find the bug :blush: One needs if (wid == -1 || wid == kDefault) return; instead of if (wid == -1 && wid == kDefault) return; can you fix that and recompile the code ??? I’ve committed the correction to BNL CVS. To re-build QtRoot try

cd "INSTALL_QTROOT working directory" source set_environment.sh cd qtRoot cvs up make make installThen try your application again and tell me the outcome.
INSTALL_QTROOT.sh.txt (21 KB)

.

[quote=“dsmcc”]I used the script from root.bnl.gov/QtRoot/INSTALL_QTROOT.sh given in this thread:
root.cern.ch/phpBB2/viewtopic.ph … hlight=qt4
to install root with qt extensions. This installs by default, Root V5.18. Is there a way to change it to install the latest (V5.20)?
Thanks,
dsmcc.[/quote]Yes, find and edit the line

ROOT_VERSION_MAJOR=5.18Can you send me your code ? Can you do

cd qtRoot/qtExamples qmake maketo build Qt4 test suite ?

Call your attention to the lines (they can be found within many examples)

#if ROOT_VERSION_CODE >= ROOT_VERSION(5,16,0) // Make sure the ROOT graphical layer is initialised. static struct needgraph { needgraph () { TApplication::NeedGraphicsLibs() ; gApplication->InitializeGraphics();} } needgraph; #endifProbably you should add it to your code too.

Expect some delay with my responce because of the 4 days long Thanksgiving holidays in USA

[quote=“dsmcc”]#11 0x009af73b in IsWidget (d=0xffffffff) at src/TGQt.cxx:110 #12 0x009b70e5 in TGQt::SetDoubleBuffer (this=0x9fc07e8, wid=2, mode=1) at src/TGQt.cxx:2087 #13 0x001466ac in TCanvas::SetDoubleBuffer (this=0x9f84318, mode=1) at gpad/src/TCanvas.cxx:1741[/quote]I am awaiting your example to reproduce the issue. Mean time I have been trying to investigate the issue further. The trouble method is

void TGQt::SetDoubleBuffer(int wid, int mode) { if (wid == -1 && wid == kDefault) return; QPaintDevice *dev = iwid(wid); if ( TQtWidget *widget = (TQtWidget *)IsWidget(dev) ) widget->SetDoubleBuffer(mode); } and I did spot the bug :blush: One needs if (wid == -1 || wid == kDefault) return; instead of if (wid == -1 && wid == kDefault) return; can you fix that and recompile the code ???
I’ve committed the correction to BNL CVS. To re-build QtRoot try

cd "INSTALL_QTROOT working directory" source set_environment.sh cd qtRoot cvs up make make installThen try your application again and tell me the outcome. If that will fix your problem I propagate the correction to CERN SVN as well.

Hi,
thanks for your replies…during the time i was waiting for your reply, I too tried many things and I found that changing
connect(qApp,SIGNAL(lastWindowClosed()),TQtRootSlot::CintSlot(),SLOT(Terminateand Quit()));
to
connect(qApp,SIGNAL(lastWindowClosed()),TQtRootSlot::CintSlot(),SLOT(Terminate()));

i.e changing the last argument in connect from TerminateandQuit to Terminate, did the magic.
Thanks a lot for taking your time. I will look into what you have suggested also and report. I would also like to add that I am now running root v5.21.06.

Thanks,
dsmcc

[quote=“dsmcc”]I too tried many things and I found that changing

connect(qApp,SIGNAL(lastWindowClosed()),TQtRootSlot::CintSlot(),SLOT(TerminateAndQuit()));to

i.e changing the last argument in connect from TerminateandQuit to Terminate, did the magic.
[/quote]. Thank you for your report. I’ve slightly changed the TQtRootSlot documentation. Now it reads:// To terminate the ROOT from Qt GUI element connect the signal with // the Terminate or TerminateAndQuite slot. // For example to terminate ROOT and Qt smoothly do // // connect(qApp,SIGNAL(lastWindowClosed()),TQtRootSlot::CintSlot(),SLOT(TerminateAndQuit()) // // To terminate just ROOT (in case the Qt is terminated by the other means) // connect(qApp,SIGNAL(lastWindowClosed()),TQtRootSlot::CintSlot(),SLOT(Terminate()) //. My test suit examples use the “Terminate()” slot connected to lastWindowClosed() signal and TerminateAndQuit() connected to another (not lastWindowClosed() signals). I’ll recheck the class behavour to see whether it meets the new Qt4 and ROOT 5.x features.

[quote=“dsmcc”] Is there a way to change it to install the latest (V5.20)?
[/quote]One can use the script to install any version of ROOT (5.22 and higher ) . It should work properly for Linux, Windows, Mac OS