Commit cfc3e7ba authored by Artur Grunau's avatar Artur Grunau
Browse files

Display pipeline properties in a scroll area

To stop the widget that contains pipeline properties from constant
resizing and taking space away from other widgets, its contents were put
in a scroll area that only resizes horizontally, and scrolls vertically.
parent 3a030e62
......@@ -39,6 +39,7 @@
#include "core/pipeline/abstractprocessor.h"
#include <QMdiSubWindow>
#include <QScrollBar>
namespace campvis {
......@@ -83,24 +84,31 @@ namespace campvis {
_pipelineWidget = new PipelineTreeWidget();
ui.pipelineTreeDock->setWidget(_pipelineWidget);
QWidget* rightWidget = new QWidget();
ui.pipelinePropertiesDock->setWidget(rightWidget);
_pipelinePropertiesScrollArea = new QScrollArea();
_pipelinePropertiesScrollArea->setWidgetResizable(true);
_pipelinePropertiesScrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_pipelinePropertiesScrollArea->setFrameStyle(QScrollArea::NoFrame);
_pipelinePropertiesWidget = new QWidget();
_pipelinePropertiesWidget->installEventFilter(this);
_pipelinePropertiesScrollArea->setWidget(_pipelinePropertiesWidget);
ui.pipelinePropertiesDock->setWidget(_pipelinePropertiesScrollArea);
QVBoxLayout* rightLayout = new QVBoxLayout();
rightLayout->setSpacing(4);
rightWidget->setLayout(rightLayout);
_pipelinePropertiesWidget->setLayout(rightLayout);
_btnExecute = new QPushButton("Execute Selected Pipeline/Processor", rightWidget);
_btnExecute = new QPushButton("Execute Selected Pipeline/Processor");
rightLayout->addWidget(_btnExecute);
_btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline", rightWidget);
_btnShowDataContainerInspector = new QPushButton("Inspect DataContainer of Selected Pipeline");
rightLayout->addWidget(_btnShowDataContainerInspector);
_propCollectionWidget = new PropertyCollectionWidget();
rightLayout->addWidget(_propCollectionWidget);
rightLayout->addStretch();
_logViewer = new LogViewerWidget();
ui.logViewerDock->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
ui.logViewerDock->setWidget(_logViewer);
_dcInspectorWidget = new DataContainerInspectorWidget();
......@@ -123,6 +131,15 @@ namespace campvis {
_application->s_PipelinesChanged.connect(this, &MainWindow::onPipelinesChanged);
}
bool MainWindow::eventFilter(QObject* watched, QEvent* event) {
if (watched == _pipelinePropertiesWidget && event->type() == QEvent::Resize) {
_pipelinePropertiesScrollArea->setMinimumWidth(_pipelinePropertiesWidget->minimumSizeHint().width() +
_pipelinePropertiesScrollArea->verticalScrollBar()->width());
}
return false;
}
void MainWindow::onPipelinesChanged() {
emit updatePipelineWidget(_application->_pipelines);
}
......
......@@ -43,6 +43,7 @@
#include <QHBoxLayout>
#include <QPushButton>
#include <QMdiArea>
#include <QScrollArea>
#include <vector>
namespace campvis {
......@@ -54,7 +55,7 @@ namespace campvis {
* Wraps a nice Qt GUI around the CampVisApplication instance given during creation.
*/
class MainWindow : public QMainWindow, public sigslot::has_slots<> {
Q_OBJECT;
Q_OBJECT
public:
/**
......@@ -97,6 +98,14 @@ namespace campvis {
*/
void addVisualizationPipelineWidget(const std::string& name, QWidget* canvas);
protected:
/**
* Listens to resize events on _pipelinePropertiesWidget and resizes _pipelinePropertiesScrollArea accordingly
* \param watched the object that caused the event
* \param event the event to be filtered
*/
bool eventFilter(QObject* watched, QEvent* event);
signals:
/// Qt signal for updating the PipelineWidget.
void updatePipelineWidget(const std::vector<AbstractPipeline*>&);
......@@ -144,6 +153,8 @@ namespace campvis {
QMdiArea* _mdiArea; ///< MDI area (the window's central widget)
PipelineTreeWidget* _pipelineWidget; ///< Widget for browsing the active pipelines
QWidget* _pipelinePropertiesWidget; ///< Widget showing the selected pipeline's properties
QScrollArea* _pipelinePropertiesScrollArea; ///< Scroll area for _pipelinePropertiesWidget
PropertyCollectionWidget* _propCollectionWidget; ///< Widget for brosing the PropertyCollection of the selected pipeline/processor
DataContainerInspectorWidget* _dcInspectorWidget; ///< Widget for inspecting the DataContainer of the selected pipeline.
QDockWidget* _dcInspectorDock; ///< Dock storing the above DataContainerInspectorWidget instance.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment