[C++-sig] Can boost.python and PyQt be used together?

David Abrahams dave at boost-consulting.com
Mon Dec 9 20:38:45 CET 2002


"Paul F. Kunz" <Paul_Kunz at SLAC.Stanford.EDU> writes:

> Still having trouble with my Boost.Python wrapping of classes derived
> from Qt.   If one recalls I have
>
>   def ( "WCFactory", WCFactory, 
>    	return_value_policy < reference_existing_object > () );
>
>   class_ <WindowController> ( "WindowController" )
>     .def ( "newCanvas", 
> 	   ( CanvasWindow * ( WindowController::* ) // function pointer
> 	     (void) ) // arguments

You may remember that I warned you that the previous line could be
unsafe...

Avoid casts if possible, especially C-style casts.

> 	   &WindowController::newCanvas,
>   	   return_internal_reference <> () )
>     ;
>
> Do I have to anything special when exposing CanvasWindow?   Currently
> I have
>
> 	class_ < CanvasWindow > ( "CanvasWindow" )
> 	  .def ( "show", &CanvasWindow::show )
> 	  .def ( "fileNew", &CanvasWindow::fileNew )
> 	  ;

How would anyone know? We can't see CanvasWindow.


-- 
                       David Abrahams
   dave at boost-consulting.com * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution





More information about the Cplusplus-sig mailing list