VTK  9.4.20250205
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
11class QGraphicsScene;
12class QWidget;
13
14VTK_ABI_NAMESPACE_BEGIN
15
23class VTKGUISUPPORTQT_EXPORT vtkQWidgetTexture : public vtkTextureObject
24{
25public:
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
54
55protected:
58
59 QGraphicsScene* Scene;
60 QWidget* Widget;
61
62 // method called when the widget needs repainting
63 std::function<void()> RedrawMethod;
64
65 // internal method to setup the scene/framebuffer/etc
67
68 unsigned char* ImageBuffer;
69 std::array<int, 2> ImageBufferDimensions;
70
71private:
72 vtkQWidgetTexture(const vtkQWidgetTexture&) = delete;
73 void operator=(const vtkQWidgetTexture&) = delete;
74};
75
76VTK_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.
void Activate() override
Activate and Bind the texture.
void ReleaseGraphicsResources(vtkWindow *win) override
Free resources.
std::array< int, 2 > ImageBufferDimensions
QGraphicsScene * Scene
QWidget * GetWidget()
Set/Get the QWidget that this TextureObject will render/use.
void AllocateFromWidget()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetWidget(QWidget *w)
Set/Get the QWidget that this TextureObject will render/use.
static vtkQWidgetTexture * New()
QGraphicsScene * GetScene()
get the QScene used for rendering, this is where events will be forwarded to.
std::function< void()> RedrawMethod
~vtkQWidgetTexture() override
unsigned char * ImageBuffer
abstracts an OpenGL texture object.
window superclass for vtkRenderWindow
Definition vtkWindow.h:48