ROOT Qt4

Hi guys,

I have followed the instructions at

root.bnl.gov/QtRoot/How2Install4Unix.html#long

and Installed Qt 4.6.2 and ROOT V5.29/02. At this point I am trying to replicate the code from the 26 ROOT/Qt Integration Interfaces. The first two examples compiled fine with the right flags for Qt4 and I am stuck at the third one.

I have created the following files (see attached)

MyButton.pro (Will not let me attach this one)

TEMPLATE = lib dll thread
# Input
HEADERS += TMyQButton.h
SOURCES += TMyQButton.cxx

CREATE_ROOT_DICT_FOR_CLASSES = ${HEADERS} LinkDef.h
include("$(ROOTSYS)/include/rootcint.pri")

LinkDef.h
TMyQButton.cxx
TMyQButton.h

I get

qmake MyButton.pro
Project MESSAGE: Found Qt extensions library !!!
WARNING: Failure to find: MyButtonDict.cxx
make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../Qt-4.6.2/mkspecs/linux-g++-64 -I. -I../../../Qt-4.6.2/include/QtCore -I../../../Qt-4.6.2/include/QtGui -I../../../Qt-4.6.2/include -I/home/radu/Desktop/QtRoot/root/include -I/home/radu/Desktop/QtRoot/root/include -I. -o TMyQButton.o TMyQButton.cxx
TMyQButton.cxx: In member function ‘void TMyQButton::SetOn(Bool_t)’:
TMyQButton.cxx:21:12: error: ‘class QPushButton’ has no member named ‘setOn’
TMyQButton.cxx: In member function ‘void TMyQButton::SetStyle(const char*)’:
TMyQButton.cxx:27:26: error: no matching function for call to ‘QPushButton::setStyle(const char*&)’
../../../Qt-4.6.2/include/QtGui/qwidget.h:239:10: note: candidate is: void QWidget::setStyle(QStyle*)
make: *** [TMyQButton.o] Error 1

I am a bit confused by the WARNING: Failure to find: MyButtonDict.cxx (I am assuming this is causing the errors when the code is compiled). Please advise me on how to fix this problem and if possible explain why it happened.

Radu
TMyQButton.h (392 Bytes)
TMyQButton.cxx (1004 Bytes)
LinkDef.h (157 Bytes)

I changed my .pro file to

######################################################################
# Automatically generated by qmake (2.01a) Mon Jun 6 10:52:48 2011
######################################################################

TEMPLATE = lib dll thread
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += LinkDef.h TMyQButton.h
SOURCES += TMyQButton.cxx

include("$(ROOTSYS)/include/rootcint.pri")

I believe the errors that I got were because QPushButton does not have a setOn method anymore and the setStyle was changed judging by the class reference for Qt4. I thought Qt4 had support for Qt3.

Qt3 and Qt4 are two different packages
See
doc.qt.nokia.com/latest/porting4-overview.html
and
doc.qt.nokia.com/4.0/porting4.html
for details

As soon as you [quote="radusorici "]followed the instructions at
root.bnl.gov/QtRoot/How2Install4Unix.html#long[/quote]you should get the qtExamples subdirectory with Qt4 compliant examples.

Hi fine,

I did all of those steps and I believe I have everything running now. It is pretty nice to be using Qt and having full ROOT capabilities.

Radu

=D>