Skip to content

Commit e1e2c20

Browse files
committed
Do not create empty Aspect_DisplayConnection instance on Windows platform
Fixes building with OCCT with introduced Xw_DisplayConnection, and Aspect_DisplayConnection constructor made protected.
1 parent 3be7b4f commit e1e2c20

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

occt-qopenglwidget/OcctQOpenGLWidgetViewer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ typedef Aspect_DisplayConnection Xw_DisplayConnection;
4040
OcctQOpenGLWidgetViewer::OcctQOpenGLWidgetViewer(QWidget* theParent)
4141
: QOpenGLWidget(theParent)
4242
{
43-
Handle(Aspect_DisplayConnection) aDisp = new Xw_DisplayConnection();
44-
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
43+
Handle(Aspect_DisplayConnection) aDisp;
44+
#if !defined(__APPLE__) && !defined(_WIN32)
45+
aDisp = new Xw_DisplayConnection();
46+
#endif
47+
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
4548
// lets QOpenGLWidget to manage buffer swap
4649
aDriver->ChangeOptions().buffersNoSwap = true;
4750
// don't write into alpha channel

occt-qtquick/OcctQQuickFramebufferViewer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ typedef Aspect_DisplayConnection Xw_DisplayConnection;
4141
OcctQQuickFramebufferViewer::OcctQQuickFramebufferViewer(QQuickItem* theParent)
4242
: QQuickFramebufferObject(theParent)
4343
{
44-
Handle(Aspect_DisplayConnection) aDisp = new Xw_DisplayConnection();
45-
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
44+
Handle(Aspect_DisplayConnection) aDisp;
45+
#if !defined(__APPLE__) && !defined(_WIN32)
46+
aDisp = new Xw_DisplayConnection();
47+
#endif
48+
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
4649
// lets QtQuick to manage buffer swap
4750
aDriver->ChangeOptions().buffersNoSwap = true;
4851
// don't write into alpha channel

occt-qwidget/OcctQWidgetViewer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ typedef Aspect_DisplayConnection Xw_DisplayConnection;
3939
OcctQWidgetViewer::OcctQWidgetViewer(QWidget* theParent)
4040
: QWidget(theParent)
4141
{
42-
Handle(Aspect_DisplayConnection) aDisp = new Xw_DisplayConnection();
43-
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
42+
Handle(Aspect_DisplayConnection) aDisp;
43+
#if !defined(__APPLE__) && !defined(_WIN32)
44+
aDisp = new Xw_DisplayConnection();
45+
#endif
46+
Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(aDisp, false);
4447

4548
// create viewer
4649
myViewer = new V3d_Viewer(aDriver);

0 commit comments

Comments
 (0)