[vtkusers] Question about the shape-shifting __getattr__ magic of QVTKRenderWindowInteractor

Elvis Stansvik elvis.stansvik at orexplore.com
Wed Jun 15 09:10:13 EDT 2016


2016-06-15 14:47 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:

> On Wed, Jun 15, 2016 at 5:55 AM, Elvis Stansvik <
> elvis.stansvik at orexplore.com> wrote:
>
>>
>> Forgive my ignorance, but is this behavior something that is essential to
>> keep? Or was this added just as a convenience, so that instances of the
>> class can be passed to VTK methods that expect an interactor?
>>
>
> The name of the class is "QVTKRenderWindowInteractor" which is a contract
> with the user that the class can be used where a vtkRenderWindowInteractor
> can be used.  The author of QVTKRenderWindowInteractor must have wanted it
> to appear as if it was subclass of vtkRenderWindowInteractor, but didn't
> want to use multiple inheritance.
>

Alright, that makes sense of course. I think the reason I'm asking these
questions at all is I'm a little unsure how the class is meant to be used,
and I hadn't seen any examples of where it is used as if it was a
vtkRenderWindowInteractor.


>
> In short, I'd like to know if I can remove this whole thing, and if so,
>> what the consequences would be.
>>
>
> Removing it would break some people's apps.
>

Yes, sorry I was unclear. I wasn't suggesting removing it in VTK proper,
but in the class I'm making now (where I'm looking at
QVTKRenderWindowInteractor for some inspiration on how to get the basic Qt
<-> VTK rendering/input bridging working).


>
>
>> My goal is to have something that feels more like a Qt API for this
>> class.. But since I'm new to VTK, and still haven't quite figured out how
>> the class is to be used in certain situations (see my post about using it
>> with context views for instance), I'd appreciate some guidance.
>>
>
> If you're changing the API to have a different feel, then you're writing a
> new class, so give your new class a new name.
>

Yes, absolutely. At the moment I'm calling it simply VTKWidget in our code
tree.

Elvis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160615/5a15a2c7/attachment.html>


More information about the vtkusers mailing list