# Yet another QVTKOpenGLWidget renaming ?

**URL:** https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602
**Category:** Development
**Created:** [February 13, 2020, 7:26am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602 "2020-02-13T07:26:21Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 13, 2020, 7:26am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/1 "2020-02-13T07:26:21Z")

</div>

Hi Community,

With VTK-9 coming, I wonder if we should rename QVTKOpenGLWidget again, as the new version was not so much used after all as it has some specific failings, while it’s only advantage is to support stereo rendering.

I suggest then the following renaming :

```
QVTKOpenGLNativeWidget -> QVTKOpenGLWidget
QVTKOpenGLWidget -> QVTKOpenGLStereoWidget

```

As some have remarked it, this suggest the the newly named QVTKOpenGLStereoWidget will never be adopted as a generic widget. I personally am fine with that. So difficulties present with it are inherent to it’s design and can’t be solved on our side, but only on Qt/GraphicDriverStack which we have no control of. As this design is not preferred by the Qt community, I’m not hopeful for these issues to be fixed.

Do you have any inputs on this ?

---

<div class="post-metadata">

### Author: ![simonesneault](https://discourse.vtk.org/user_avatar/discourse.vtk.org/simonesneault/32/67_2.png) [@simonesneault](https://discourse.vtk.org/u/simonesneault)
#### Post date: [February 13, 2020, 8:11am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/2 "2020-02-13T08:11:00Z")

</div>

Hi Mathieu,  
For the sake of clarity  
+1 for the change 🙂

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [February 13, 2020, 3:16pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/3 "2020-02-13T15:16:29Z")

</div>

As a person who is usually averse to making naming changes, I think the current names are confusing at best and the suggested names are much clearer. So +1 from me.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [February 13, 2020, 10:10pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/4 "2020-02-13T22:10:04Z")

</div>

I think the rename makes sense too, so +1 from me.

The only thing I want to ask: Is it conceivable that there may be some other functionality/context besides stereo rendering for which you would choose the `QVTKOpenGLStereoWidget`? If so, is there some other name that would be more fitting, something alluding to the way the widget is implemented maybe?

If it will only ever be a choice for stereo rendering, and only stereo rendering, then the name is good.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 14, 2020, 1:14am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/5 "2020-02-14T01:14:11Z")

</div>

You may want to give us your inputs on this potential QVTKOpenGLWidget renaming :  
@embeddedmz @lassoan @Andrew @cryos @ken-martin @utkarshayachit @kerim @Paulo_Carvalho

---

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [February 14, 2020, 1:25pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/6 "2020-02-14T13:25:15Z")

</div>

+1. If we can think of a new name other than `QVTKOpenGLWidget` to avoid confusion with old name that’d be great, but not required.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [February 14, 2020, 5:03pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/7 "2020-02-14T17:03:29Z")

</div>

> [@utkarshayachit](#):
>
> If we can think of a new name other than `QVTKOpenGLWidget` to avoid confusion with old name that’d be great, but not required.

Not to stir up any long discussions, but how about vtkQWidget? I always found the QVTK prefix a little off from normal VTK class naming.

May be out of the question considering the other QVTK-prefixed helper/implementation classes, but thought I’d air the idea at least.

---

<div class="post-metadata">

### Author: ![utkarshayachit](https://discourse.vtk.org/user_avatar/discourse.vtk.org/utkarshayachit/32/379_2.png) [@utkarshayachit](https://discourse.vtk.org/u/utkarshayachit)
#### Post date: [February 14, 2020, 7:46pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/8 "2020-02-14T19:46:22Z")

</div>

> [@estan](#):
>
> I always found the QVTK prefix a little off from normal VTK class naming.

The reasoning behind the `QVTK` prefix was that it indicated to the user/developer that it is a `QObject` subclass. Also, the API style would follow Qt’s rather than VTK’s, thus methods named with lowerCase etc etc.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 16, 2020, 5:10am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/9 "2020-02-16T05:10:12Z")

</div>

QVTKOpenGLWidget sounds good, but usually the “OpenGL” word is not included in class names that users should normally use (only in low-level implementation classes). So, QVTKWidget, QVTKRenderWidget, QVTKRenderWindowWidget names would be somewhat more appropriate.

---

<div class="post-metadata">

### Author: ![estan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/estan/32/460_2.png) [@estan](https://discourse.vtk.org/u/estan)
#### Post date: [February 16, 2020, 12:21pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/10 "2020-02-16T12:21:42Z")

</div>

> [@utkarshayachit](#):
>
> The reasoning behind the `QVTK` prefix was that it indicated to the user/developer that it is a `QObject` subclass. Also, the API style would follow Qt’s rather than VTK’s, thus methods named with lowerCase etc etc.

Yep, I understand the logic. `vtk*` ==\> typically inherits `vtkObject/vtkObjectBase`, `QVTK` ==\> inherits `QObject`. I believe it’s discouraged to use the `Q*` prefix for classes outside of Qt itself though (even if the `VTK` probably makes this OK).

In my suggestion `vtkQWidget`, I thought that even if it’s not inheriting `vtkObject`, it is a VTK class, so has the `vtk*` prefix, and it’s a QWidget, hence the `QWidget` in the name (the `Q` included to not be confused with VTK’s own widgets), and the `OpenGL` has been left out since it’s an implementation detail.

But the more I think of it, it’s probably water under the bridge, with the `QVTK*` prefix used for a bunch of classes in VTK at this point. So let’s keep it that way!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 17, 2020, 3:45am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/11 "2020-02-17T03:45:13Z")

</div>

The OpenGL part is here to not confuse with the old QVTKWidget that as not been removed yet.  
Maybe it is time to remove it, but we can’t use this name either.

Also, let’s not use the WIndow term, as it is heavily charged in Qt.

For QVTKOpenGLWidget :

- QVTKStereoWidget
- QVTKStereoRenderWidget
- QVTKOpenGLStereoWidget

For QVTKOpenGLNativeWidget :

- no rename
- QVTKNativeWidget
- QVTKRenderWidget

Any other suggestions ? Which suggestions would you prefer ?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 17, 2020, 4:21am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/12 "2020-02-17T04:21:54Z")

</div>

Let’s make a poll for this to make it easier to summarize the results:

For QVTKOpenGLWidget:

_Poll ([view on site](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/12))_

For QVTKOpenGLNativeWidget:

_Poll ([view on site](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/12))_

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [February 17, 2020, 4:23am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/13 "2020-02-17T04:23:06Z")

</div>

(damn, discourse is awesome 🙂 )

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [February 17, 2020, 9:18am UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/14 "2020-02-17T09:18:53Z")

</div>

Since we derive from `QOpenGLWidget`, we should definitely keep `OpenGL` in the name.  
At some point, I expect that we will have an OpenGL and a Vulkan rendering backend and we will have difficulty to differentiate them without `OpenGL` and `Vulkan` prefixes.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [February 17, 2020, 2:24pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/15 "2020-02-17T14:24:32Z")

</div>

> [@Michael](#):
>
> Since we derive from `QOpenGLWidget` , we should definitely keep `OpenGL` in the name.  
> At some point, I expect that we will have an OpenGL and a Vulkan rendering backend and we will have difficulty to differentiate them without `OpenGL` and `Vulkan` prefixes.

+1

At some point we could have higher-level classes that dispatch to the right implementation (such as `vtkRenderer` etc.), but since we aren’t there yet but dealing directly with the OpenGL implementation, including OpenGL is okay and even necessary in my opinion.

Also, VTK class names usually read left-to-right from more specific to less specific (e.g. `vtkOpenGLRenderWindow` vs. `vtkRenderWindow`, `vtkOpenGLPolyDataMapper` vs. `vtkPolyDataMapper`, etc.). In keeping with that convention, I would vote for none of the options above but instead propose

`QVTKStereoOpenGLWidget` and `QVTKOpenGLWidget`

---

<div class="post-metadata">

### Author: ![simonesneault](https://discourse.vtk.org/user_avatar/discourse.vtk.org/simonesneault/32/67_2.png) [@simonesneault](https://discourse.vtk.org/u/simonesneault)
#### Post date: [February 17, 2020, 2:53pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/16 "2020-02-17T14:53:14Z")

</div>

> [@cory.quammen](#):
>
> `QVTKStereoOpenGLWidget` and `QVTKOpenGLWidget`

Same for me, those 2 names are simple and clear, I don’t like the other propositions

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 17, 2020, 3:20pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/17 "2020-02-17T15:20:32Z")

</div>

VTK users don’t care what underlying technology (OpenGL, OpenGLES, Vulkan, Metal, etc.) should be used to create a VTK render window in a Qt widget. Would you really want to create #ifdefs around instantiation of the render window in all Qt VTK tests, examples, and applications?

If you want, you can still expose specialized classes that allow users to choose a specific technology, but the QVTKRenderWidget should just work, with the best underlying available technology automatically selected.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [February 17, 2020, 3:37pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/18 "2020-02-17T15:37:30Z")

</div>

That seems like a desirable goal, but that is beyond a simple renaming of the existing classes. The question at hand is what to rename these very OpenGL-specific widgets. They both rely on a `vtkGenericOpenGLRenderWindow` internally.

If you want to add that implementation-agnostic level above this now and advise people to use that, I have no objection. But as for a simple rename operation _of these classes_, I am arguing OpenGL should stay in the name.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 17, 2020, 3:49pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/19 "2020-02-17T15:49:56Z")

</div>

I fully agree, we should have low-level classes that have OpenGL in their names. We should just not advertise to users that these low-level classes exist (don’t use in any examples and minimize their usage in tests) because we know that in a few years we will have alternative implementations.

It is about the same as with vtkActor / vtkOpenGLActor. Only advanced users should instantiate vtkOpenGLActor explicitly, everyone else should just use vtkActor and rely on VTK factory (or any other suitable mechanism) to instantiate the best implementation.

We should add the new implementation-agnostic classes at the same time we rename the existing classes. This allows users to switch to the final class names in one step instead of renaming classes in tests, examples, user code now and again in 1-2 years. Yes, it may require 1-2 extra days of work for a VTK developer now, but it may save an hour or more for hundreds of VTK-based projects.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.vtk.org/user_avatar/discourse.vtk.org/cory.quammen/32/6751_2.png) [@cory.quammen](https://discourse.vtk.org/u/cory.quammen)
#### Post date: [February 17, 2020, 6:35pm UTC](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602/20 "2020-02-17T18:35:11Z")

</div>

Right now the poll is mixing both names for a high-level factory mechanism and an implementation-specific renaming, and that I think is confusing matters.

We should first get consensus that a factory mechanism/generic name for these widgets is the way to go, then figure out what their names should be. Agreed?

[Next page](https://discourse.vtk.org/t/yet-another-qvtkopenglwidget-renaming/2602.md?page=2)
