aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/rhi/simplerhiwidget/main.py
blob: 59be81ddcaf9ff7409b563cba72cf7829bd1ef63 (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
# Copyright (C) 2024 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

"""PySide6 port of the Qt Simple RHI Widget Example example from Qt v6.x"""

import sys

from PySide6.QtWidgets import QApplication, QVBoxLayout, QWidget

from examplewidget import ExampleRhiWidget
import rc_simplerhiwidget  # noqa F:401


class Widget(QWidget):

    def __init__(self, parent=None):
        super().__init__(parent)
        layout = QVBoxLayout(self)
        self._rhi_widget = ExampleRhiWidget(self)
        layout.addWidget(self._rhi_widget)

    def closeEvent(self, e):
        self._rhi_widget.releaseResources()
        e.accept()


if __name__ == "__main__":
    app = QApplication(sys.argv)

    w = Widget()
    w.resize(1280, 720)
    w.show()
    exit_code = app.exec()
    del w
    sys.exit(exit_code)