22 auto verticalLayout =
new QVBoxLayout(
this );
24 m_matInstanceNameLabel =
new QLabel();
25 m_matNameLabel =
new QLabel();
26 m_matProperties =
new QPlainTextEdit();
27 m_matProperties->setReadOnly(
true );
29 auto nameLayout =
new QHBoxLayout();
30 nameLayout->addWidget(
new QLabel(
"Instance name :" ) );
31 nameLayout->addWidget( m_matInstanceNameLabel );
32 verticalLayout->addLayout( nameLayout );
34 m_matInfoGroup =
new QGroupBox();
35 m_matInfoGroup->setTitle(
"Material Informations" );
36 m_matInfoGroup->setCheckable(
false );
37 auto matInfoForm =
new QFormLayout( m_matInfoGroup );
38 matInfoForm->addRow( tr(
"Material Type :" ), m_matNameLabel );
39 matInfoForm->addRow( tr(
"Instance Properties :" ), m_matProperties );
40 m_matInfoGroup->setMaximumHeight( 150 );
41 verticalLayout->addWidget( m_matInfoGroup );
42 m_matInfoGroup->setVisible(
false );
44 auto matParamsGroup =
new QGroupBox();
45 matParamsGroup->setTitle(
"Edit Parameters" );
46 matParamsGroup->setEnabled(
true );
47 matParamsGroup->setCheckable(
false );
49 verticalLayout->addWidget( matParamsGroup );
50 m_matParamsLayout =
new QVBoxLayout( matParamsGroup );
52 m_matParamsLayout->addWidget( m_parametersControlPanel );
54 verticalLayout->addStretch();
61 m_matNameLabel->setText( QString::fromStdString( material->getMaterialName() ) );
62 m_matProperties->clear();
63 for (
auto& prop : material->getPropertyList() ) {
64 m_matProperties->appendPlainText( QString::fromStdString( prop ) );
67 auto tmpCursor = m_matProperties->textCursor();
68 tmpCursor.movePosition( QTextCursor::Start );
69 m_matProperties->setTextCursor( tmpCursor );
71 auto& params = material->getParameters();
72 auto metadata = ( hasMetadata ) ? hasMetadata->getParametersMetadata() : nlohmann::json {};
74 m_matInstanceNameLabel->setText( material->getInstanceName().c_str() );
77 m_matParamsLayout->removeWidget( m_parametersControlPanel );
78 delete m_parametersControlPanel;
81 m_matParamsLayout->addWidget( m_parametersControlPanel );
83 m_parametersControlPanel->
setupUi( params, metadata );
85 connect( m_parametersControlPanel,
88 m_matInfoGroup->setVisible(
true );