From 3ed34ed76c46e830582f73dfd2c459d9acc5c6d8 Mon Sep 17 00:00:00 2001 From: Michael Fabian Dirks Date: Mon, 3 Oct 2016 02:22:58 +0200 Subject: [PATCH] UI: Split Properties window with a QSplitter --- UI/window-basic-properties.cpp | 21 +++++++++++++-------- UI/window-basic-properties.hpp | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/UI/window-basic-properties.cpp b/UI/window-basic-properties.cpp index 2fad427da5cc64..35efbf5fd9e0ff 100644 --- a/UI/window-basic-properties.cpp +++ b/UI/window-basic-properties.cpp @@ -70,21 +70,26 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_) view = new OBSPropertiesView(settings, source, (PropertiesReloadCallback)obs_source_properties, (PropertiesUpdateCallback)obs_source_update); + //view->setMaximumHeight(250); + view->setMinimumHeight(150); + view->show(); - preview->setMinimumSize(20, 20); + preview->setMinimumSize(20, 150); preview->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); + // Create a QSplitter to keep a unified workflow here. + windowSplitter = new QSplitter(Qt::Orientation::Vertical, this); + windowSplitter->addWidget(preview); + windowSplitter->addWidget(view); + windowSplitter->setChildrenCollapsible(false); + windowSplitter->setSizes(QList({ 16777216, 150 })); + setLayout(new QVBoxLayout(this)); - layout()->addWidget(preview); - layout()->addWidget(view); + layout()->addWidget(windowSplitter); layout()->addWidget(buttonBox); layout()->setAlignment(buttonBox, Qt::AlignRight | Qt::AlignBottom); - layout()->setAlignment(view, Qt::AlignBottom); - view->setMaximumHeight(250); - view->setMinimumHeight(150); - view->show(); - + installEventFilter(CreateShortcutFilter()); const char *name = obs_source_get_name(source); diff --git a/UI/window-basic-properties.hpp b/UI/window-basic-properties.hpp index a5cbfa92546399..b21a2cf7d947f3 100644 --- a/UI/window-basic-properties.hpp +++ b/UI/window-basic-properties.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "qt-display.hpp" #include @@ -42,6 +43,7 @@ class OBSBasicProperties : public QDialog { OBSData oldSettings; OBSPropertiesView *view; QDialogButtonBox *buttonBox; + QSplitter *windowSplitter; static void SourceRemoved(void *data, calldata_t *params); static void SourceRenamed(void *data, calldata_t *params);