feat(parameterUI): add parameter panel
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "Gui/Interface.h"
|
||||
#include "Engine/Network/NetworkManager.h"
|
||||
#include "Gui/ParametersPanel/ParametersPanel.h"
|
||||
#include "Gui/Viewport/Viewport.h"
|
||||
#include "Gui/Network/Network.h"
|
||||
#include <qnamespace.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qsplitter.h>
|
||||
#include <QTimer>
|
||||
@@ -23,24 +25,31 @@ EnzoUI::EnzoUI()
|
||||
|
||||
Viewport* viewport = new Viewport();
|
||||
Network* network = new Network(this);
|
||||
ParametersPanel* parametersPanel = new ParametersPanel();
|
||||
|
||||
constexpr int margin = 2;
|
||||
viewport->layout()->setContentsMargins(margin, margin, margin, margin);
|
||||
network->layout()->setContentsMargins(margin, margin, margin, margin);
|
||||
parametersPanel->layout()->setContentsMargins(margin, margin, margin, margin);
|
||||
mainLayout_->setContentsMargins(margin, margin, margin, margin);
|
||||
|
||||
|
||||
viewportSplitter_ = new Splitter(this);
|
||||
networkSplitter_ = new Splitter(this);
|
||||
networkSplitter_->setOrientation(Qt::Vertical);
|
||||
|
||||
|
||||
|
||||
viewportSplitter_->addWidget(viewport);
|
||||
viewportSplitter_->addWidget(network);
|
||||
// viewportSplitter_->addWidget(new QPushButton("hello world"));
|
||||
|
||||
viewportSplitter_->setStretchFactor(0, 20);
|
||||
viewportSplitter_->addWidget(networkSplitter_);
|
||||
viewportSplitter_->setStretchFactor(0, 40);
|
||||
viewportSplitter_->setStretchFactor(1, 1);
|
||||
|
||||
networkSplitter_->addWidget(parametersPanel);
|
||||
networkSplitter_->addWidget(network);
|
||||
networkSplitter_->setStretchFactor(0, 1);
|
||||
networkSplitter_->setStretchFactor(1, 15);
|
||||
|
||||
mainLayout_->addWidget(viewportSplitter_);
|
||||
|
||||
// connect signals
|
||||
|
||||
@@ -14,6 +14,7 @@ class EnzoUI
|
||||
QVBoxLayout* mainLayout_;
|
||||
QVBoxLayout* viewportSplitLayout_;
|
||||
Splitter* viewportSplitter_;
|
||||
Splitter* networkSplitter_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -307,9 +307,7 @@ void Network::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
case(Qt::Key_Tab):
|
||||
{
|
||||
std::cout << "here\n";
|
||||
tabMenu_->showOnMouse();
|
||||
std::cout << "here\n";
|
||||
break;
|
||||
}
|
||||
case(Qt::Key_G):
|
||||
@@ -414,3 +412,4 @@ void Network::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
bool Network::focusNextPrevChild(bool) { return false; }
|
||||
|
||||
@@ -156,4 +156,5 @@ protected:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
bool focusNextPrevChild(bool) override;
|
||||
};
|
||||
|
||||
35
src/Gui/ParametersPanel/ParametersPanel.cpp
Normal file
35
src/Gui/ParametersPanel/ParametersPanel.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "Gui/ParametersPanel/ParametersPanel.h"
|
||||
#include <qboxlayout.h>
|
||||
#include <QSpinBox>
|
||||
#include <qwidget.h>
|
||||
#include <QLineEdit>
|
||||
|
||||
ParametersPanel::ParametersPanel(QWidget *parent, Qt::WindowFlags f)
|
||||
: QWidget(parent, f)
|
||||
{
|
||||
mainLayout_ = new QVBoxLayout();
|
||||
parametersLayout_ = new QVBoxLayout();
|
||||
bgWidget_ = new QWidget();
|
||||
bgWidget_->setLayout(parametersLayout_);
|
||||
|
||||
bgWidget_->setObjectName("ParametersPanelBg");
|
||||
bgWidget_->setStyleSheet(R"(
|
||||
QWidget#ParametersPanelBg {
|
||||
background-color: #282828;
|
||||
border-radius: 10px;
|
||||
}
|
||||
)"
|
||||
);
|
||||
|
||||
mainLayout_->addLayout(parametersLayout_);
|
||||
mainLayout_->addWidget(bgWidget_);
|
||||
|
||||
parametersLayout_->addWidget(new QSpinBox());
|
||||
parametersLayout_->addWidget(new QSpinBox());
|
||||
parametersLayout_->addWidget(new QSpinBox());
|
||||
parametersLayout_->addWidget(new QLineEdit());
|
||||
parametersLayout_->addWidget(new QLineEdit());
|
||||
|
||||
|
||||
setLayout(mainLayout_);
|
||||
}
|
||||
16
src/Gui/ParametersPanel/ParametersPanel.h
Normal file
16
src/Gui/ParametersPanel/ParametersPanel.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
class ParametersPanel
|
||||
: public QWidget
|
||||
{
|
||||
public:
|
||||
ParametersPanel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
|
||||
private:
|
||||
QVBoxLayout* mainLayout_;
|
||||
QVBoxLayout* parametersLayout_;
|
||||
QWidget* bgWidget_;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user