#include "PropertiesPanel.h" #include "PropertyWidgets.h" #include #include #include #include "Core/Object.h" PropertiesPanel::PropertiesPanel(QWidget* parent) : QWidget(parent) { this->setObjectName("PropertiesPanel"); this->setAttribute(Qt::WA_StyledBackground); m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(0); // Title bar m_titleBar = new QWidget(this); m_titleBar->setObjectName("PaneTitleBar"); m_titleBar->setFixedHeight(22); auto* titleLayout = new QHBoxLayout(m_titleBar); titleLayout->setContentsMargins(5, 0, 5, 0); m_titleLabel = new QLabel("Properties", m_titleBar); m_titleLabel->setObjectName("TitleLabel"); titleLayout->addWidget(m_titleLabel); titleLayout->addStretch(); m_layout->addWidget(m_titleBar); // Editor m_editor = new uLib::Qt::PropertyEditor(this); m_layout->addWidget(m_editor, 1); } void PropertiesPanel::setObject(uLib::Object* obj) { if (obj) { m_titleLabel->setText(QString("Properties: %1 (%2)") .arg(QString::fromStdString(obj->GetInstanceName())) .arg(obj->GetClassName())); } else { m_titleLabel->setText("Properties: (No selection)"); } m_editor->setObject(obj); } PropertiesPanel::~PropertiesPanel() {}