From 6262abc2c81772ca2bbb4763e2d0bb8fc9d39284 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 9 Jan 2016 14:47:58 -0800 Subject: [PATCH] UI: Resize main preview on the widget's resize signal Fixes a bug where the preview's size calculations wouldn't update if the widget itself was resizes but the window wasn't resized. --- obs/window-basic-main.cpp | 17 +++++------------ obs/window-basic-main.hpp | 1 - 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 32fe344ac..3c3b092b5 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -162,12 +162,15 @@ OBSBasic::OBSBasic(QWidget *parent) ui->scenes->setAttribute(Qt::WA_MacShowFocusRect, false); ui->sources->setAttribute(Qt::WA_MacShowFocusRect, false); - connect(windowHandle(), &QWindow::screenChanged, [this]() { + auto displayResize = [this]() { struct obs_video_info ovi; if (obs_get_video_info(&ovi)) ResizePreview(ovi.base_width, ovi.base_height); - }); + }; + + connect(windowHandle(), &QWindow::screenChanged, displayResize); + connect(ui->preview, &OBSQTDisplay::DisplayResized, displayResize); installEventFilter(CreateShortcutFilter()); @@ -2312,16 +2315,6 @@ void OBSBasic::changeEvent(QEvent *event) UNUSED_PARAMETER(event); } -void OBSBasic::resizeEvent(QResizeEvent *event) -{ - struct obs_video_info ovi; - - if (obs_get_video_info(&ovi)) - ResizePreview(ovi.base_width, ovi.base_height); - - OBSMainWindow::resizeEvent(event); -} - void OBSBasic::on_actionShow_Recordings_triggered() { const char *mode = config_get_string(basicConfig, "Output", "Mode"); diff --git a/obs/window-basic-main.hpp b/obs/window-basic-main.hpp index afdac76e2..1396197a3 100644 --- a/obs/window-basic-main.hpp +++ b/obs/window-basic-main.hpp @@ -301,7 +301,6 @@ public: protected: virtual void closeEvent(QCloseEvent *event) override; virtual void changeEvent(QEvent *event) override; - virtual void resizeEvent(QResizeEvent *event) override; private slots: void on_actionShow_Recordings_triggered();