28 #include <QPushButton>
37 m_layouter = std::make_unique<FormLayouter>(
this, ec);
44 auto* chooseColorAction =
new QAction(
this);
45 chooseColorAction->setText(
"Choose color");
46 chooseColorAction->setIcon(QIcon(
":/images/palette.svg"));
47 chooseColorAction->setIconText(
"Choose color");
48 chooseColorAction->setToolTip(
"Choose a color for this layer");
49 auto* menu =
new QMenu(
this);
50 chooseColorAction->setMenu(menu);
55 auto* ca = menu->addAction(QIcon(p),
"");
56 connect(ca, &QAction::triggered, [=]() {
79 setStyleSheet(
"QGroupBox {background-color: " + bckgroundCol.name(QColor::HexRgb) +
"}");
87 for (
auto* layout : layer->
layouts())
91 auto* btn =
new QPushButton(
"Add particle layout",
this);
92 connect(btn, &QPushButton::clicked, [=] { ec->
addLayout(
this); });
117 setStyleSheet(
"QGroupBox {background-color: " + bckgroundCol.name(QColor::HexRgb) +
"}");
140 const bool isFirstLayer = sample->
layers().first() ==
m_layer;
141 const bool isLastLayer = sample->layers().last() ==
m_layer;
142 const bool thicknessIsSemiInfinite =
143 (isFirstLayer || isLastLayer) && (sample->layers().size() != 1);
144 const bool thicknessIsInfinite = sample->layers().size() == 1;
151 if (thicknessIsSemiInfinite || thicknessIsInfinite) {
152 auto* info = qobject_cast<QLineEdit*>(w);
153 if (info ==
nullptr) {
155 info =
new QLineEdit(
this);
156 info->setEnabled(
false);
157 info->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
160 info->setText(thicknessIsSemiInfinite ?
"Semi-infinite" :
"Infinite");
161 }
else if (!thicknessIsSemiInfinite && !thicknessIsInfinite
162 && (qobject_cast<QLineEdit*>(w) !=
nullptr)) {
182 const int rowInLayout =
Defines class ActionFactory.
Defines class GroupBoxCollapser.
Defines class MaterialItem.
Defines class MaterialItems.
Defines class MultiLayerItem.
Defines class ParticleLayoutForm.
static QAction * createShowInRealSpaceAction(QObject *parent, const QString &what, std::function< void()> slot=nullptr)
Create "show in RealSpace" action.
static QAction * createRemoveAction(QObject *parent, const QString &what, std::function< void()> slot=nullptr)
Create "remove" action.
QString label
A label text (short, no trailing colon)
void setExpanded(bool expanded=true)
Expand/collapse the content area.
void addAction(QAction *action)
Add a tool button to the title bar, connected to the given action.
void addWidget(QWidget *widget)
Add a widget to the title bar.
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
void setTitle(const QString &title)
Set the title of the group box. Do not use the method groupBox->setTitle() any more once the add-on i...
QString materialName() const
UIntDescriptor numSlices() const
void setColor(const QColor &color)
QVector< ParticleLayoutItem * > layouts() const
DoubleDescriptor thickness() const
QString layerName() const
SelectionDescriptor< LayerBasicRoughnessItem * > roughness()
void materialChanged(MaterialItem *materialItem)
QVector< LayerItem * > layers() const
Form for editing a particle layout.
Class to modify a sample from the layer oriented sample editor.
MultiLayerItem * sampleItem() const
The item on which this controller operates.
void requestViewInRealSpace(SampleItem item)
MaterialItems * materialItems() const
The materials of the current document.
void onStoppedToMoveLayer(QWidget *widgetToMove, QWidget *moveAboveThisWidget)
void onStartingToMoveLayer()
void addLayout(LayerForm *layerItem)
void removeLayer(LayerItem *layerItem)
QList< QColor > predefinedLayerColors()