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.
This commit is contained in:
parent
d7d5e55d2c
commit
6262abc2c8
@ -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");
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user