blob: 0ac947b0589a0a41e4c3f13abd56f2300d91157f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef RHIWIDGET_H
#define RHIWIDGET_H
#include <QWidget>
#include <rhi/qrhi.h>
class QRhiWidgetPrivate;
class QRhiWidget : public QWidget
{
Q_OBJECT
Q_DECLARE_PRIVATE(QRhiWidget)
Q_PROPERTY(QSize explicitSize READ explicitSize WRITE setExplicitSize NOTIFY explicitSizeChanged)
public:
QRhiWidget(QWidget *parent = nullptr, Qt::WindowFlags f = {});
~QRhiWidget();
enum Api {
OpenGL,
Metal,
Vulkan,
D3D11,
Null
};
Api api() const;
void setApi(Api api);
bool isDebugLayerEnabled() const;
void setDebugLayer(bool enable);
QRhiTexture::Format textureFormat() const;
void setTextureFormat(QRhiTexture::Format format);
QSize explicitSize() const;
void setExplicitSize(const QSize &pixelSize);
virtual void initialize(QRhi *rhi, QRhiTexture *outputTexture);
virtual void render(QRhiCommandBuffer *cb);
QImage grabTexture();
Q_SIGNALS:
void explicitSizeChanged(const QSize &pixelSize);
protected:
void resizeEvent(QResizeEvent *e) override;
void paintEvent(QPaintEvent *e) override;
bool event(QEvent *e) override;
};
#endif
|