*** GMX Spamverdacht *** Re: [PyQt] PyQt4 question

Andreas Pakulat apaku at gmx.de
Sun May 27 22:57:23 BST 2007


On 27.05.07 14:53:08, Detlev Offenbach wrote:
> On Sonntag, 27. Mai 2007, Giovanni Bajo wrote:
> > On 27/05/2007 13.37, Detlev Offenbach wrote:
> > >>> -----------------------------------------------------------------------
> > >>>-- -- - class QDesignerFormEditorPluginInterface
> > >>> {
> > >>>
> > >>> %TypeHeaderCode
> > >>> #include <abstractformeditorplugin.h>
> > >>> %End
> > >>>
> > >>> public:
> > >>>     virtual ~QDesignerFormEditorPluginInterface();
> > >>>
> > >>>     virtual bool isInitialized() const = 0;
> > >>>     virtual void initialize(QDesignerFormEditorInterface *core) = 0;
> > >>>     virtual QAction *action() const = 0;
> > >>>
> > >>>     virtual QDesignerFormEditorInterface *core() const = 0;
> > >>> };
> > >>> -----------------------------------------------------------------------
> > >>>-- --
> > >>
> > >> What RTTI is available for the code to determine what the class really
> > >> is? I can't see anything that is obviously suitable - in which case you
> > >> are stuck.
> > >
> > > In a C++ program one would do it with this statement
> > >
> > > qobject_cast<QDesignerFormEditorPluginInterface*>(object)
> > >
> > > where object is a pointer to a QObject. If the conversion code would be
> > > in QObject.sip, one could probably use the inherits() method of QObject.
> >
> > Uh? Does QDesignerFormEditorPluginInterface inherit from QObject?
> > Otherwise, I can't see how the qobject_cast can work.
> 
> I have no idea. I had a look into edyuk, and they do it that way and it works 
> there (unless there is some magic somewhere else in their code).

One reason could be that the QDesignerFormEditorPluginInterface is a
Q_INTERFACE and the real QObject-derived implementation declares its
inheritance from that interface. I guess qobject_cast<> takes that into
account.

Andreas

-- 
A long-forgotten loved one will appear soon.

Buy the negatives at any price.


More information about the PyQt mailing list