VTK  9.3.20240328
vtkQWidgetTexture.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef vtkQWidgetTexture_h
4 #define vtkQWidgetTexture_h
5 
6 #include "vtkGUISupportQtModule.h" // For export macro
7 #include "vtkTextureObject.h"
8 #include <array> // for ivar
9 #include <functional> // for ivar
10 
11 class QGraphicsScene;
12 class QWidget;
13 
14 VTK_ABI_NAMESPACE_BEGIN
15 
23 class VTKGUISUPPORTQT_EXPORT vtkQWidgetTexture : public vtkTextureObject
24 {
25 public:
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
31 
34  void SetWidget(QWidget* w);
35  QWidget* GetWidget() { return this->Widget; }
37 
42  QGraphicsScene* GetScene() { return this->Scene; }
43 
48  void Activate() override;
49 
53  void ReleaseGraphicsResources(vtkWindow* win) override;
54 
55 protected:
57  ~vtkQWidgetTexture() override;
58 
59  QGraphicsScene* Scene;
60  QWidget* Widget;
61 
62  // method called when the widget needs repainting
64 
65  // internal method to setup the scene/framebuffer/etc
67 
68  unsigned char* ImageBuffer;
69  std::array<int, 2> ImageBufferDimensions;
70 
71 private:
72  vtkQWidgetTexture(const vtkQWidgetTexture&) = delete;
73  void operator=(const vtkQWidgetTexture&) = delete;
74 };
75 
76 VTK_ABI_NAMESPACE_END
77 #endif
a simple class to control print indentation
Definition: vtkIndent.h:108
Allows a QWidget to be used as a texture in VTK with OpenGL.
QWidget * GetWidget()
Set/Get the QWidget that this TextureObject will render/use.
void Activate() override
Activate and Bind the texture.
void ReleaseGraphicsResources(vtkWindow *win) override
Free resources.
std::array< int, 2 > ImageBufferDimensions
QGraphicsScene * Scene
void AllocateFromWidget()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
QGraphicsScene * GetScene()
get the QScene used for rendering, this is where events will be forwarded to.
static vtkQWidgetTexture * New()
void SetWidget(QWidget *w)
Set/Get the QWidget that this TextureObject will render/use.
std::function< void()> RedrawMethod
~vtkQWidgetTexture() override
unsigned char * ImageBuffer
abstracts an OpenGL texture object.
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
@ Scene
Definition: vtkX3D.h:154
@ function
Definition: vtkX3D.h:249