Skip to content

Commit

Permalink
UI: Split Properties window with a QSplitter
Browse files Browse the repository at this point in the history
Closes #645
  • Loading branch information
Michael Fabian Dirks authored and jp9000 committed Oct 10, 2016
1 parent d324713 commit bd60678
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 13 additions & 7 deletions UI/window-basic-properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions UI/window-basic-properties.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QPointer>
#include <QSplitter>
#include "qt-display.hpp"
#include <obs.hpp>

Expand All @@ -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);
Expand Down

0 comments on commit bd60678

Please sign in to comment.