Skip to content

Commit 41fbec4

Browse files
Simplified qtDisplay
1 parent d0bec4e commit 41fbec4

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

src/Display/qtDisplay.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
log = logging.getLogger(__name__)
3636

3737

38-
class qtBaseViewer(QtWidgets.QWidget):
38+
class qtBaseViewer(QtOpenGL.QGLWidget):
3939
''' The base Qt Widget for an OCC viewer
4040
'''
4141

@@ -111,19 +111,14 @@ def __init__(self, *kargs):
111111
self._rightisdown = False
112112
self._selection = None
113113
self._drawtext = True
114-
self._qApp = QtWidgets.QApplication.instance()
115114
self._key_map = {}
116115
self._current_cursor = "arrow"
117116
self._available_cursors = {}
118117

119118
@property
120119
def qApp(self):
121120
# reference to QApplication instance
122-
return self._qApp
123-
124-
@qApp.setter
125-
def qApp(self, value):
126-
self._qApp = value
121+
return QtWidgets.QApplication.instance()
127122

128123
def InitDriver(self):
129124
self._display.Create(self.GetHandle())
@@ -172,26 +167,12 @@ def keyPressEvent(self, event):
172167
self._key_map[code]()
173168
else:
174169
log.info("key: %s \nnot mapped to any function", code)
175-
176-
def Test(self):
177-
if self._inited:
178-
self._display.Test()
179-
180-
def focusInEvent(self, event):
181-
if self._inited:
182-
self._display.Repaint()
183-
184-
def focusOutEvent(self, event):
185-
if self._inited:
186-
self._display.Repaint()
187-
170+
188171
def paintEvent(self, event):
189-
if self._inited:
190-
self._display.Context.UpdateCurrentViewer()
191-
# important to allow overpainting of the OCC OpenGL context in Qt
192-
# self.context().swapBuffers()
193-
else:
172+
if not self._inited:
194173
self.InitDriver()
174+
175+
self._display.Context.UpdateCurrentViewer()
195176

196177
if self._drawbox:
197178
painter = QtGui.QPainter(self)

0 commit comments

Comments
 (0)