22 #include <QPushButton>
24 #include <QVBoxLayout>
27 const QSize default_dialog_size(512, 400);
31 : QDialog(parent), m_origMaterialModel(materialModel), m_materialEditor(nullptr)
33 setWindowTitle(
"Material Editor");
34 setMinimumSize(128, 128);
35 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
39 auto layout =
new QVBoxLayout;
40 layout->setContentsMargins(0, 0, 0, 0);
68 auto result =
new QHBoxLayout;
70 auto okButton =
new QPushButton(
"OK");
72 auto cancelButton =
new QPushButton(
"Cancel");
75 result->setMargin(10);
76 result->setSpacing(5);
77 result->addStretch(1);
78 result->addWidget(okButton);
79 result->addWidget(cancelButton);
102 resize(default_dialog_size);
#define ASSERT(condition)
Defines class MaterialEditorDialog.
Defines class MaterialEditor.
Defines class MaterialItemUtils.
Defines class MaterialModel.
DefinesStyleUtils namespace.
The ExternalProperty class defines custom QVariant property to carry the text, color and an identifie...
void init_material_editor()
void setMaterialProperty(const ExternalProperty &matProperty)
std::unique_ptr< MaterialModel > m_tmpMaterialModel
QBoxLayout * createButtonLayout()
MaterialEditor * m_materialEditor
MaterialEditorDialog(MaterialModel *materialModel, QWidget *parent=nullptr)
void onOKButton()
replaces original material model with the model modified by MaterialEditor
ExternalProperty selectedMaterialProperty()
MaterialModel * m_origMaterialModel
Main widget of MaterialEditor.
bool modelWasChanged() const
MaterialItem * selectedMaterial()
void setInitialMaterialProperty(const ExternalProperty &matProperty)
Sets selection corresponding to initial material property.
MaterialModel * createCopy(SessionItem *parent=nullptr)
virtual void initFrom(SessionModel *model, SessionItem *parent)
Defines namespace Constants.
const char S_MATERIALEDITOR[]
const char S_WINDOWPOSITION[]
const char S_WINDOWSIZE[]
ExternalProperty materialProperty(const SessionItem &materialItem)
Constructs material property corresponding to given material.
void setResizable(QDialog *dialog)
Make modal dialog resizable.