Qt 4.8
qplatformwindowformat_qpa.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #ifndef QPLATFORMWINDOWFORMAT_QPA_H
42 #define QPLATFORMWINDOWFORMAT_QPA_H
43 
44 #include <QtGui/QPlatformWindow>
45 
47 
49 
50 QT_MODULE(Gui)
51 
53 
55 {
56 public:
57  enum FormatOption {
58  DoubleBuffer = 0x0001,
59  DepthBuffer = 0x0002,
60  Rgba = 0x0004,
61  AlphaChannel = 0x0008,
62  AccumBuffer = 0x0010,
63  StencilBuffer = 0x0020,
64  StereoBuffers = 0x0040,
65  DirectRendering = 0x0080,
66  HasOverlay = 0x0100,
67  SampleBuffers = 0x0200,
69  HasWindowSurface = 0x0800,
72  ColorIndex = Rgba << 16,
81  NoWindowSurface = HasWindowSurface << 16
82 
83  };
84  Q_DECLARE_FLAGS(FormatOptions, FormatOption)
85 
86  enum WindowApi {
90  };
91 
93  QPlatformWindowFormat(FormatOptions options);
95  QPlatformWindowFormat &operator=(const QPlatformWindowFormat &other);
97 
98  void setDepthBufferSize(int size);
99  int depthBufferSize() const;
100 
101  void setAccumBufferSize(int size);
102  int accumBufferSize() const;
103 
104  void setRedBufferSize(int size);
105  int redBufferSize() const;
106 
107  void setGreenBufferSize(int size);
108  int greenBufferSize() const;
109 
110  void setBlueBufferSize(int size);
111  int blueBufferSize() const;
112 
113  void setAlphaBufferSize(int size);
114  int alphaBufferSize() const;
115 
116  void setStencilBufferSize(int size);
117  int stencilBufferSize() const;
118 
119  void setSampleBuffers(bool enable);
120  bool sampleBuffers() const;
121 
122  void setSamples(int numSamples);
123  int samples() const;
124 
125  void setSwapInterval(int interval);
126  int swapInterval() const;
127 
128  void setWindowApi(QPlatformWindowFormat::WindowApi api);
129  WindowApi windowApi() const;
130 
131  void setSharedContext(QPlatformGLContext *context);
132  QPlatformGLContext *sharedGLContext() const;
133 
134  bool doubleBuffer() const;
135  void setDoubleBuffer(bool enable);
136  bool depth() const;
137  void setDepth(bool enable);
138  bool rgba() const;
139  void setRgba(bool enable);
140  bool alpha() const;
141  void setAlpha(bool enable);
142  bool accum() const;
143  void setAccum(bool enable);
144  bool stencil() const;
145  void setStencil(bool enable);
146  bool stereo() const;
147  void setStereo(bool enable);
148  bool directRendering() const;
149  void setDirectRendering(bool enable);
150  bool hasWindowSurface() const;
151  void setWindowSurface(bool enable);
152 
153  void setOption(QPlatformWindowFormat::FormatOptions opt);
154  bool testOption(QPlatformWindowFormat::FormatOptions opt) const;
155 
156  static QPlatformWindowFormat defaultFormat();
157  static void setDefaultFormat(const QPlatformWindowFormat& f);
158 
159 private:
161 
162  void detach();
163 
166 #ifndef QT_NO_DEBUG_STREAM
168 #endif
169 };
170 
173 
174 #ifndef QT_NO_DEBUG_STREAM
176 #endif
177 
178 Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformWindowFormat::FormatOptions)
179 
180 inline bool QPlatformWindowFormat::doubleBuffer() const
181 {
182  return testOption(QPlatformWindowFormat::DoubleBuffer);
183 }
184 
185 inline bool QPlatformWindowFormat::depth() const
186 {
187  return testOption(QPlatformWindowFormat::DepthBuffer);
188 }
189 
190 inline bool QPlatformWindowFormat::rgba() const
191 {
192  return testOption(QPlatformWindowFormat::Rgba);
193 }
194 
195 inline bool QPlatformWindowFormat::alpha() const
196 {
197  return testOption(QPlatformWindowFormat::AlphaChannel);
198 }
199 
200 inline bool QPlatformWindowFormat::accum() const
201 {
202  return testOption(QPlatformWindowFormat::AccumBuffer);
203 }
204 
206 {
207  return testOption(QPlatformWindowFormat::StencilBuffer);
208 }
209 
210 inline bool QPlatformWindowFormat::stereo() const
211 {
212  return testOption(QPlatformWindowFormat::StereoBuffers);
213 }
214 
216 {
217  return testOption(QPlatformWindowFormat::DirectRendering);
218 }
219 
221 {
222  return testOption(QPlatformWindowFormat::HasWindowSurface);
223 }
224 
226 {
227  return testOption(QPlatformWindowFormat::SampleBuffers);
228 }
229 
231 
233 
234 #endif //QPLATFORMWINDOWFORMAT_QPA_H
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
bool rgba() const
Returns true if RGBA color mode is set.
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
#define Q_OPENGL_EXPORT
Definition: qglobal.h:1455
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
Definition: qgl.h:147
QPlatformWindowFormatPrivate * d
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QPlatformWindowFormat &)
bool stereo() const
Returns true if stereo buffering is enabled; otherwise returns false.
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
bool depth() const
Returns true if the depth buffer is enabled; otherwise returns false.
bool accum() const
Returns true if the accumulation buffer is enabled; otherwise returns false.
The QPlatformGLContext class provides an abstraction for native GL contexts.
bool stencil() const
Returns true if the stencil buffer is enabled; otherwise returns false.
Q_GUI_EXPORT bool operator!=(const QPlatformWindowFormat &, const QPlatformWindowFormat &)
bool directRendering() const
Returns true if direct rendering is enabled; otherwise returns false.
Q_GUI_EXPORT bool operator==(const QPlatformWindowFormat &, const QPlatformWindowFormat &)
bool alpha() const
Returns true if the alpha buffer in the framebuffer is enabled; otherwise returns false...
bool sampleBuffers() const
Returns true if multisample buffer support is enabled; otherwise returns false.
#define QT_END_HEADER
Definition: qglobal.h:137
bool hasWindowSurface() const
Returns true if the corresponding widget has an instance of QWindowSurface.