UI: Split Properties window with a QSplitter

Closes jp9000/obs-studio#645
master
Michael Fabian Dirks 2016-10-03 02:22:58 +02:00 committed by jp9000
parent d324713364
commit bd606785fe
2 changed files with 15 additions and 7 deletions

View File

@ -70,21 +70,27 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
view = new OBSPropertiesView(settings, source,
(PropertiesReloadCallback)obs_source_properties,
(PropertiesUpdateCallback)obs_source_update);
view->setMinimumHeight(150);
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<int>({ 16777216, 150 }));
windowSplitter->setStretchFactor(0, 3);
windowSplitter->setStretchFactor(1, 1);
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();
view->show();
installEventFilter(CreateShortcutFilter());
const char *name = obs_source_get_name(source);

View File

@ -20,6 +20,7 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QPointer>
#include <QSplitter>
#include "qt-display.hpp"
#include <obs.hpp>
@ -42,6 +43,7 @@ private:
OBSData oldSettings;
OBSPropertiesView *view;
QDialogButtonBox *buttonBox;
QSplitter *windowSplitter;
static void SourceRemoved(void *data, calldata_t *params);
static void SourceRenamed(void *data, calldata_t *params);