Dear Timur, I have the same problem Oliver mentions in this thread, namely porting a Qt-based application containing a ROOT TCanvas embedded inside a Qt widget from a Linux (where it works just fine) to Mac (Sierra, where it crashes).
In a class inheriting from QWidget I have:
int wid = gVirtualX->AddWindow((ULong_t)winId(), width(), height());
wid is always returned zero (on a Mac) and therefore
fCanvas = new TCanvas(title.c_str(), width(), height(), wid);
spits out a message
**Fatal error: requested non-existing drawable 0**
**This drawable not found among allocated/deleted drawables**
Did you succeed in your program to develop the code in a hackaton as you write in this thread on Nov’15?
My code has been developed in over five years by me and a bunch of students which non longer work with me and it would be practically impossible for me to reengineer the code without ROOT and Qt.
Here’s the full snippet (QRootCanvas inherits from a QWidget):
QRootCanvas::QRootCanvas(QWidget *parent, string title) : QWidget(parent, 0), fCanvas(0)
{
setAttribute (Qt::WA_PaintOnScreen, true);
setAttribute (Qt::WA_OpaquePaintEvent, true);
setAttribute (Qt::WA_NativeWindow, true);
setMinimumSize (50, 50);
setUpdatesEnabled(kFALSE);
setMouseTracking (kTRUE );
int wid = gVirtualX->AddWindow((ULong_t)winId(), width(), height());
this->setGeometry(
0,
0,
parent->width(),
parent->height()
);
fCanvas = new TCanvas(title.c_str(), width(), height(), wid);
TQObject::Connect("TGPopMenu", "PoppedDown()", "TCanvas", fCanvas, "Update()") ;
}
Thanks for any help you might provide on this!
Dario