Hi, I ported a legacy application from ROOT5 and QT4.8 to ROOT6 and QT5.
I used Bertrand’s suggestion (shown below) which compiles and runs.
Problem is, the canvas size remains small and of a fixed size (which was not the old behavior):
I tried to hard-wire different values for the width and height, but no matter what, the size of the canva remains utterly small (something around 100x80 pixels…
Since it worked fine with ROOT6 compiled against Qt4.8.5, am I missing a new recipe here?
Since with Qt5 an annoying message appears on STDOUT, cluttering my formatted ouput, saying
QWidget::paintEngine: Should no longer be called
I thought the the culprit was the fCanvas->Update() call therein, so I altogether removed the paintEvent and the resizeEvent re-implementation from my code, generating the problem I mentioned in my post.
I didn’t notice this immediately because after my removal I didn’t check the result and after a few days I forgot about it. Now I restored them and the code is running as was originally planned.
The question remains: how do I get rid of the annoying > QWidget::paintEngine: Should no longer be called message?
I’m sorry, but if I set Qt::WA_PaintOnScreen to false, the code compiles and runs but the size of the canvas, within the parent widget, becomes very small and there is no way of making it bigger.
By the way: what should I do to intercept the contextMenu of a TCanvas? I would like to be able to propose users a contextMenu whenever they hover the mouse over the cell of a scatter plot. This requires me to override the ROOT context menu with mine (TQObject::Connect mechanism? If so, how?)
And to use you own context menu, replace fCanvas->HandleInput(kButton3Down, e->x(), e->y()); in void QRootCanvas::mousePressEvent( QMouseEvent *e ) and/or fCanvas->HandleInput(kButton3Up, e->x(), e->y());
in void QRootCanvas::mouseReleaseEvent( QMouseEvent *e ) with your own code, or any other solution…