On 2009-07-01 02:17+0300 Dmitri Gribenko wrote: > On Wed, Jul 1, 2009 at 1:35 AM, trc<keats73-plp...@yahoo.co.uk> wrote: >> You cannot use dynamic_cast to convert the void pointer pls->dev to a >> QtPLWidget pointer. >> >> The purpose of dynamic_cast is to do a safe (runtime checked) cast >> from a base class to a derived class or vice-versa. As QtPLWidget is >> not derived from void the cast fails. > > There is a C-style cast to a QWidget * first. Its result is then > passed to dynamic_cast, which should work in such case (but does not > for some reason; multiple inheritance problems?). > >> For your code you have to use C++ reinterpret_cast or a C style cast. > > Agreed. I don't see why dynamic_cast should be necessary here. In > any case, 'widget' variable is of type QtPLDriver * and all concrete > types (QtRasterDevice, QtSVGDevice, QtEPSDevice, QtPLWidget) are not > used after the cast. There's also a cryptic comment that I don't > understand "We have to dynamic_cast to make sure the good virtual > functions are called". Everything dynamic_cast can do here is to cut > off all derived types except the specified ones (they would be cast to > NULL, but I don't see why that should be needed). > > Am I missing anything about that code?
Thanks Terrence and Dmitri for your ideas about how to solve this issue. I believe Alban will not be able to comment in a timely manner because he is probably out of e-mail contact right now. Given that situation, I suggest you both in consultation make the casting changes you think are right and send me the patch. If I find that examples/python/pyqt4_test.py (in the installed examples tree) suddenly starts working (rather than delivering a blank GUI result) and your patch shows no regressions for any of our extensive tests of the qt devices or for qt_example itself, then I would be happy to commit your patch. Of course, I would be also be happy to make any further changes beyond that commit that Alban thinks are necessary when he is back in contact. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ ------------------------------------------------------------------------------ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel