29
29
Qt , QCoreApplication , QPointF , QPoint , QRect , QRectF , QSize , QMutex , QTimer
30
30
)
31
31
from PyQt5 .QtGui import (
32
- QTransform , QPainter , QPixmap , QColor , QPen , QBrush , QCursor ,
32
+ QTransform , QPainter , QPixmap , QColor , QPen , QBrush , QCursor , QImage , QRegion
33
33
)
34
34
from PyQt5 .QtWidgets import QSizePolicy , QWidget , QPushButton
35
35
@@ -977,7 +977,7 @@ def regionTriggered(self, clip_id):
977
977
self .region_enabled = False
978
978
else :
979
979
self .region_enabled = True
980
-
980
+
981
981
get_app ().window .refreshFrameSignal .emit ()
982
982
983
983
def resizeEvent (self , event ):
@@ -995,16 +995,18 @@ def delayed_resize_callback(self):
995
995
# Trying to find the closest even number to the requested aspect ratio
996
996
# so that both width and height are divisible by 2. This is to prevent some
997
997
# strange phantom scaling lines on the edges of the preview window.
998
- ratio = float (get_app ().project .get ("width" )) / float (get_app ().project .get ("height" ))
999
- width = round (self .delayed_size .width () / 2.0 ) * 2
1000
- height = (round (width / ratio ) / 2.0 ) * 2
1001
998
1002
- # Override requested size
1003
- self .delayed_size .setWidth (width )
1004
- self .delayed_size .setHeight (height )
999
+ # Scale project size (with aspect ratio) to the delayed widget size
1000
+ project_size = QSize (get_app ().project .get ("width" ), get_app ().project .get ("height" ))
1001
+ project_size .scale (self .delayed_size , Qt .KeepAspectRatio )
1002
+
1003
+ # Calculate height/width divisible by 2
1004
+ ratio = float (project_size .width ()) / float (project_size .height ())
1005
+ width = round (project_size .width () / 2.0 ) * 2
1006
+ height = (round (width / ratio ) / 2.0 ) * 2
1005
1007
1006
1008
# Emit signal that video widget changed size
1007
- self .win .MaxSizeChanged .emit (self . delayed_size )
1009
+ self .win .MaxSizeChanged .emit (project_size )
1008
1010
1009
1011
# Capture wheel event to alter zoom/scale of widget
1010
1012
def wheelEvent (self , event ):
0 commit comments