@ -23,7 +23,7 @@ import logging; logger = logging.getLogger(__name__); logger.info("import")
#Third Party
from PyQt5 import QtCore , QtGui , QtWidgets , QtOpenGL
from PyQt5 import QtCore , QtGui , QtWidgets
#Template Modules
from template . helper import onlyOne
@ -42,24 +42,28 @@ class ScoreView(QtWidgets.QGraphicsView):
self . scoreScene = GuiScore ( parentView = self )
self . setScene ( self . scoreScene )
viewport = QtOpenGL . QGLWidget ( QtOpenGL . QGLFormat ( QtOpenGL . QGL . SampleBuffers ) )
viewport . format ( ) . setSwapInterval ( 0 ) #disable VSync.
viewport . setAutoFillBackground ( False )
viewport = QtWidgets . QOpenGLWidget ( )
#These special parameters should not matter. Run with the default.
#viewportFormat = QtGui.QSurfaceFormat()
#viewportFormat.setSwapInterval(0) #disable VSync
#viewportFormat.setSamples(2**8)
#viewportFormat.setDefaultFormat(viewportFormat)
#viewport.setFormat(viewportFormat)
self . setViewport ( viewport )
opengl = True
if opengl :
#Scrolling without openGl is sluggish. This is a sure improvement. -2022.
from PyQt5 import QtOpenGL
viewport = QtWidgets . QOpenGLWidget ( )
#viewport = QtOpenGL.QGLWidget(QtOpenGL.QGLFormat(QtOpenGL.QGL.SampleBuffers))
#These special parameters should not matter. Run with the default.
viewportFormat = QtGui . QSurfaceFormat ( )
viewportFormat . setSwapInterval ( 0 ) #disable VSync
viewportFormat . setDefaultFormat ( viewportFormat )
viewport . setFormat ( viewportFormat )
self . setViewport ( viewport )
self . viewport ( ) . setAutoFillBackground ( False )
self . setAlignment ( QtCore . Qt . AlignLeft | QtCore . Qt . AlignTop )
#self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
#self.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag)
self . setDragMode ( QtWidgets . QGraphicsView . NoDrag )
api . callbacks . setCursor . append ( self . centerOnCursor ) #returns a dict
api . callbacks . updateBlockTrack . append ( self . updateMode ) # We need this after every update because the track is redrawn after each update and we don't know what to show