Skip to content

Commit

Permalink
enable QGL viewport
Browse files Browse the repository at this point in the history
much faster rendering, especially in multicut with edge overlays.
  • Loading branch information
k-dominik committed Aug 31, 2023
1 parent 1dca59c commit 04adae4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions volumina/imageView2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from builtins import range
from PyQt5.QtCore import QPoint, QPointF, QTimer, pyqtSignal, Qt, QRectF
from PyQt5.QtGui import QCursor, QPainter, QImage
from PyQt5.QtWidgets import QGraphicsView, QVBoxLayout, QApplication, QMessageBox
from PyQt5.QtWidgets import QGraphicsView, QVBoxLayout, QApplication, QMessageBox, QOpenGLWidget

import numpy
import os
Expand All @@ -36,7 +36,6 @@
from .croppingMarkers import CroppingMarkers
from volumina.widgets.wysiwygExportOptionsDlg import WysiwygExportOptionsDlg

from PyQt5.QtOpenGL import QGLWidget

# *******************************************************************************
# I m a g e V i e w 2 D *
Expand Down Expand Up @@ -105,10 +104,8 @@ def __init__(self, parent, cropModel, imagescene2d):

QGraphicsView.__init__(self, parent)

# We can't use OpenGL because the HUD doesn't render properly on top.
# Maybe this will be fixed in Qt5?
if False:
self.setViewport(QGLWidget())
# TODO: make this configurable
self.setViewport(QOpenGLWidget())

Check warning on line 108 in volumina/imageView2D.py

View check run for this annotation

Codecov / codecov/patch

volumina/imageView2D.py#L108

Added line #L108 was not covered by tests

self.setScene(imagescene2d)
self.mousePos = QPointF(0, 0)
Expand Down Expand Up @@ -245,7 +242,7 @@ def _deaccelerate(self, speed, a=1, maxVal=64):

def _qBound(self, minVal, current, maxVal):
"""PyQt5 does not wrap the qBound function from Qt's global namespace
This is equivalent."""
This is equivalent."""
return max(min(current, maxVal), minVal)

def _setdeaccelerateAxAy(self, x, y, a):
Expand Down

0 comments on commit 04adae4

Please sign in to comment.