From 7b7fc920488991bd5776b351a2ac6ee2f58b3342 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 11 Jul 2014 15:36:50 +0200 Subject: [PATCH] qv4l2: reset size after changing aspect ratios or scaling mode When the video or pixel aspect ratio is changed by the user, or if scaling is enabled/disabled, reset the window size to the optimal size. This behavior is much more natural. Signed-off-by: Hans Verkuil --- utils/qv4l2/capture-win.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp index 4b89944..640b7f6 100644 --- a/utils/qv4l2/capture-win.cpp +++ b/utils/qv4l2/capture-win.cpp @@ -175,8 +175,7 @@ void CaptureWin::updateSize() void CaptureWin::setCropMethod(CropMethod crop) { m_cropMethod = crop; - QResizeEvent event (QSize(width(), height()), QSize(width(), height())); - QCoreApplication::sendEvent(this, &event); + resetSize(); } QSize CaptureWin::pixelAspectFrameSize(QSize size) @@ -210,8 +209,7 @@ void CaptureWin::enableScaling(bool enable) QWidget::setMinimumSize(MIN_WIN_SIZE_WIDTH, MIN_WIN_SIZE_HEIGHT); } m_enableScaling = enable; - QResizeEvent event (QSize(width(), height()), QSize(width(), height())); - QCoreApplication::sendEvent(this, &event); + resetSize(); } void CaptureWin::setWindowSize(QSize frameSize) @@ -273,8 +271,7 @@ QSize CaptureWin::scaleFrameSize(QSize window, QSize frame) void CaptureWin::setPixelAspectRatio(double ratio) { m_pixelAspectRatio = ratio; - QResizeEvent event(QSize(width(), height()), QSize(width(), height())); - QCoreApplication::sendEvent(this, &event); + resetSize(); } void CaptureWin::closeEvent(QCloseEvent *event) -- 2.7.4