Slot conection error

Hi all,

I got an error while running my GUI :

Error in <TQObject::CheckConnectArgs>: slot PopUpSlcioBrowser() does not exist

It seems that the signal/slot connection couldn’t be done. Here my header and source file :

Header

  /// \file EventNavigator.hh
/*
 *
 * EventNavigator.hh header template generated by fclass
 * Creation date : lun. mai 6 2013
 * Copyright (c) CNRS , IPNL
 *
 * All Right Reserved.
 * Use and copying of these libraries and preparation of derivative works
 * based upon these libraries are permitted. Any copy of these libraries
 * must include this copyright notice.
 * 
 * @author : rete
 */


#ifndef EVENTNAVIGATOR_HH
#define EVENTNAVIGATOR_HH

#include <iostream> 
#include <string> 
#include <cstdlib> 
#include <cmath> 
#include <vector> 


//#include "TGMainFrame.h"
#include "TQObject.h"
#include "TGNumberEntry.h"
#include "TGFrame.h"
#include "TGButton.h"
#include "TGLabel.h"
#include "TSystem.h"
#include "TGFileDialog.h"
#include <RQ_OBJECT.h>
#include "EventLoader.hh"

namespace baboon {

	/*
	 * Class EventNavigator
	 */

	class EventNavigator : public TQObject {

		RQ_OBJECT("EventNavigator")

		public:
			/*! Default Constructor */
			EventNavigator( TGMainFrame* prt );
			/*! Default Destructor */
			virtual ~EventNavigator();

			// signal to process event!
			void ProcessEvent();

			void PopUpSlcioBrowser();


		protected:

			TGMainFrame* parent;
			TGNumberEntry *entryNumberWidget;
			TGGroupFrame *eventFrame;
			TGHorizontalFrame* horizontalFrame;
			TGPictureButton *goBackButton;
			TGPictureButton *goForwardButton;
			TGPictureButton *browseLcioButton;
			TGLabel *goToEventLabel;
			EventLoader *eventLoader;


			ClassDef(EventNavigator, 0)
	};  // class

}  // namespace 

#endif  //  EVENTNAVIGATOR_HH
  /// \file EventNavigator.cc
/*
 *
 * EventNavigator.cc source template generated by fclass
 * Creation date : lun. mai 6 2013
 * Copyright (c) CNRS , IPNL
 *
 * All Right Reserved.
 * Use and copying of these libraries and preparation of derivative works
 * based upon these libraries are permitted. Any copy of these libraries
 * must include this copyright notice.
 * 
 * @author : rete
 */


#include "Gui/EventNavigator.hh"

namespace baboon {

	EventNavigator::EventNavigator( TGMainFrame* prt ) {

		parent = prt;
		eventFrame = new TGGroupFrame(parent, "Event Navigation", kHorizontalFrame);
		horizontalFrame = new TGHorizontalFrame(parent);

		eventFrame->AddFrame(horizontalFrame);

		TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) );

		goBackButton = new TGPictureButton(horizontalFrame,gClient->GetPicture(icondir + "GoBack.gif"));
		horizontalFrame->AddFrame(goBackButton);
//		goBackButton->Connect("Clicked()", "EventNavigator", fh, "PreviousEvent()");

		goForwardButton = new TGPictureButton(horizontalFrame,gClient->GetPicture(icondir + "GoForward.gif"));
		horizontalFrame->AddFrame(goForwardButton);
//		goForwardButton->Connect("Clicked()", "EventNavigator", fh, "NextEvent()");

		TGHorizontalFrame *eventFrame2 = new TGHorizontalFrame(eventFrame);

	    goToEventLabel = new TGLabel(eventFrame2, " Go to \n event" );

	    browseLcioButton = new TGPictureButton(eventFrame2,gClient->GetPicture(icondir + "fileopen.xpm"));
	    browseLcioButton->Connect("Clicked()", "EventNavigator", this, "PopUpSlcioBrowser()");

	    eventLoader = new EventLoader();

		entryNumberWidget = new TGNumberEntry( eventFrame2 , 0 , 5.0, -1,
		                						TGNumberFormat::kNESInteger,
		                						TGNumberFormat::kNEAAnyNumber,
		                						TGNumberFormat::kNELLimitMinMax,
		                						0, 100000);

		eventFrame2->AddFrame(goToEventLabel);
		eventFrame2->AddFrame(entryNumberWidget);
		eventFrame2->AddFrame(browseLcioButton);

//		entryNumberWidget->Connect("ValueSet(Long_t)", "EventNavigator", 0, "GotoEvent()");

	    eventFrame->AddFrame(eventFrame2);
	    parent->AddFrame(eventFrame);
	}

	EventNavigator::~EventNavigator() {;}

	void EventNavigator::PopUpSlcioBrowser() {

	    TGFileInfo fileInfo;
		const char *filetypes[] = {"LCIO files","*.slcio",0,0};
		fileInfo.fFileTypes = filetypes;
		fileInfo.fIniDir = StrDup(TString("."));

		new TGFileDialog(gClient->GetRoot(), parent, kFDOpen, &fileInfo);

	}


}  // namespace 

I grab most of the piece of code from the root tutorials so that I really don’t know what is goind wrong.

Thanks !

rete

Hi,

Since your [color=#0000FF]EventNavigator[/color] class already inherits from [color=#0000FF]TQObject[/color], you can remove "[color=#0000FF]RQ_OBJECT(“EventNavigator”)[/color]"
Then, you have to use the “baboon” namespace in the class name of the Connect() method:

browseLcioButton->Connect("Clicked()", "baboon::EventNavigator", this, "PopUpSlcioBrowser()");
Cheers, Bertrand.