Reintroduce QWindow::SurfaceType
On Cocoa it makes sense to distinguish between the two window types. Reviewed-by: Samuel
This commit is contained in:
parent
0e4844aa24
commit
def5901955
@ -24,6 +24,7 @@ HelloWindow::HelloWindow(Renderer *renderer)
|
|||||||
: m_colorIndex(0)
|
: m_colorIndex(0)
|
||||||
, m_renderer(renderer)
|
, m_renderer(renderer)
|
||||||
{
|
{
|
||||||
|
setSurfaceType(QWindow::OpenGLSurface);
|
||||||
setWindowTitle(QLatin1String("Hello Window"));
|
setWindowTitle(QLatin1String("Hello Window"));
|
||||||
|
|
||||||
setFormat(renderer->format());
|
setFormat(renderer->format());
|
||||||
|
@ -72,6 +72,18 @@ QWindow::~QWindow()
|
|||||||
destroy();
|
destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QWindow::setSurfaceType(SurfaceType surfaceType)
|
||||||
|
{
|
||||||
|
Q_D(QWindow);
|
||||||
|
d->surfaceType = surfaceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWindow::SurfaceType QWindow::surfaceType() const
|
||||||
|
{
|
||||||
|
Q_D(const QWindow);
|
||||||
|
return d->surfaceType;
|
||||||
|
}
|
||||||
|
|
||||||
void QWindow::setVisible(bool visible)
|
void QWindow::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
|
@ -100,9 +100,14 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
|
|||||||
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
|
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum SurfaceType { RasterSurface, OpenGLSurface };
|
||||||
|
|
||||||
QWindow(QWindow *parent = 0);
|
QWindow(QWindow *parent = 0);
|
||||||
virtual ~QWindow();
|
virtual ~QWindow();
|
||||||
|
|
||||||
|
void setSurfaceType(SurfaceType surfaceType);
|
||||||
|
SurfaceType surfaceType() const;
|
||||||
|
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
bool visible() const;
|
bool visible() const;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate
|
|||||||
public:
|
public:
|
||||||
QWindowPrivate()
|
QWindowPrivate()
|
||||||
: QObjectPrivate()
|
: QObjectPrivate()
|
||||||
|
, surfaceType(QWindow::RasterSurface)
|
||||||
, windowFlags(Qt::Window)
|
, windowFlags(Qt::Window)
|
||||||
, parentWindow(0)
|
, parentWindow(0)
|
||||||
, platformWindow(0)
|
, platformWindow(0)
|
||||||
@ -75,6 +76,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWindow::SurfaceType surfaceType;
|
||||||
Qt::WindowFlags windowFlags;
|
Qt::WindowFlags windowFlags;
|
||||||
QWindow *parentWindow;
|
QWindow *parentWindow;
|
||||||
QPlatformWindow *platformWindow;
|
QPlatformWindow *platformWindow;
|
||||||
|
@ -143,6 +143,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
|
|||||||
winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
|
winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
|
||||||
|
|
||||||
if (!widget->windowHandle()->handle()) {
|
if (!widget->windowHandle()->handle()) {
|
||||||
|
widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
|
||||||
widget->windowHandle()->setFormat(winFormat);
|
widget->windowHandle()->setFormat(winFormat);
|
||||||
widget->winId();//make window
|
widget->winId();//make window
|
||||||
}
|
}
|
||||||
@ -294,6 +295,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
|
|||||||
d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
|
d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
|
||||||
|
|
||||||
d->window = new QWindow;
|
d->window = new QWindow;
|
||||||
|
d->window->setSurfaceType(QWindow::OpenGLSurface);
|
||||||
d->window->setGeometry(QRect(0, 0, 3, 3));
|
d->window->setGeometry(QRect(0, 0, 3, 3));
|
||||||
d->window->create();
|
d->window->create();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user