Skip to content
Snippets Groups Projects
Commit c69e2773 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

add color property to LayerItem (necessary for the upcoming layer-oriented sample editor)

parent d17ff862
No related branches found
No related tags found
1 merge request!412More preparations for layer oriented sample editor
......@@ -41,6 +41,8 @@ LayerItem::LayerItem() : SessionGraphicsItem(M_TYPE), ItemWithMaterial(M_TYPE)
->setLimits(RealLimits::lowerLimited(0.0))
.setToolTip(layer_nslices_tooltip);
addProperty(P_COLOR, QColor()); // initially no color
GroupInfo info;
info.add(LayerBasicRoughnessItem::M_TYPE, "Basic");
info.add(LayerZeroRoughnessItem::M_TYPE, "No");
......@@ -124,6 +126,16 @@ void LayerItem::removeLayout(ParticleLayoutItem* layout)
model()->removeItem(layout);
}
QColor LayerItem::color() const
{
return getItemValue(P_COLOR).value<QColor>();
}
void LayerItem::setColor(const QColor& color)
{
setItemValue(P_COLOR, color);
}
void LayerItem::updateAppearance(SessionItem* new_parent)
{
if (!new_parent) {
......
......@@ -31,6 +31,7 @@ private:
static constexpr auto P_ROUGHNESS{"Top roughness"};
static constexpr auto P_NSLICES{"Number of slices"};
static constexpr auto T_LAYOUTS{"Layout tag"};
static constexpr auto P_COLOR{"Color"};
public:
static constexpr auto M_TYPE{"Layer"};
......@@ -53,6 +54,9 @@ public:
QVector<ParticleLayoutItem*> layouts() const;
void removeLayout(ParticleLayoutItem* layout);
QColor color() const;
void setColor(const QColor& color);
private:
void updateAppearance(SessionItem* new_parent);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment