Connect Root signal to QT slot

Hi all,

I have a TCanvas in a QT application which I update by a QT timer event. When the user closes the TCanvas window, I get a segfault from the timer event as the the TCanvas no longer exists.
I now want to use the Closed()-signal from the TCanvas to stop my QT timer. Therefore I need to connect somehow the Root signal to the QT slot.
I can’t use the QT connect method as this expects a QObject, and when I use the Root connect method the the slot in my QT class is not recognized: Error in TQObject::CheckConnectArgs: slot stopGraph() does not exist

Any help for that would be highly appreciated, thanks!

QMainCanvas::QMainCanvas(QWidget *parent) : QWidget(parent)
{
    canvas = new TCanvas("canvas","CanvasTitle",0,0, width(),height());
    
    QObject::connect(canvas->GetCanvas(),SIGNAL(Closed()),this, SLOT(stopGraph()));
    
    canvas->Connect("Closed()","QMainCanvas",this,"stopGraph()");
}

void QMainCanvas::stopGraph()
{
    updateTimer->stop();
}

I need to see your application to advise.

Normally QtRoot application creates TQtWidget to represent TCanvas within Qt application.
root.cern.ch/root/html532/GRAF2D_QT_Index.html
root.cern.ch/root/html532/TQtWidget.html

Since TQtWidget is the the regular QWidget (QWidget subclass ) one can use it as such. In addition TQtWidget is in possession of the few customs Qt signals and slots. Check root.cern.ch/root/html532/TQtWidget.html
So the communication you are speaking about should no be a problem. You can find a lot of HelloWord-level examples from the Qt-distribution (see qtroot.svn.sourceforge.net/viewv … tExamples/ )

However, for some rare cases the TQtWidget /QWidget signals / slots do not suffice. For such case one can use so-called QtRootSlot
Check this:

root.bnl.gov/QtRoot/root/qt/src/TQtRootSlot.cxx