1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSURFACE_H
5#define QSURFACE_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qnamespace.h>
9#include <QtGui/qsurfaceformat.h>
10#include <QtCore/qmetatype.h>
11#include <QtCore/qsize.h>
12
13QT_BEGIN_NAMESPACE
14
15
16class QPlatformSurface;
17
18class QSurfacePrivate;
19
20class Q_GUI_EXPORT QSurface
21{
22 Q_GADGET
23public:
24 enum SurfaceClass {
25 Window,
26 Offscreen
27 };
28 Q_ENUM(SurfaceClass)
29
30 enum SurfaceType {
31 RasterSurface,
32 OpenGLSurface,
33 RasterGLSurface,
34 OpenVGSurface,
35 VulkanSurface,
36 MetalSurface,
37 Direct3DSurface
38 };
39 Q_ENUM(SurfaceType)
40
41 virtual ~QSurface();
42
43 SurfaceClass surfaceClass() const;
44
45 virtual QSurfaceFormat format() const = 0;
46 virtual QPlatformSurface *surfaceHandle() const = 0;
47
48 virtual SurfaceType surfaceType() const = 0;
49 bool supportsOpenGL() const;
50
51 virtual QSize size() const = 0;
52
53protected:
54 explicit QSurface(SurfaceClass type);
55
56 SurfaceClass m_type;
57
58 QSurfacePrivate *m_reserved;
59};
60
61QT_END_NAMESPACE
62
63QT_DECL_METATYPE_EXTERN_TAGGED(QSurface*, QSurface_ptr, Q_GUI_EXPORT)
64
65#endif //QSURFACE_H
66

source code of qtbase/src/gui/kernel/qsurface.h