Sun, 18 Mar 2018 12:37:40 +0200
fixed color handling
--- a/src/dialogs/subfilereferenceeditor.cpp Sun Mar 18 12:33:29 2018 +0200 +++ b/src/dialogs/subfilereferenceeditor.cpp Sun Mar 18 12:37:40 2018 +0200 @@ -13,10 +13,10 @@ this->ui.setupUi(this); this->ui.referenceName->setText(reference->referenceName()); this->color = reference->color(); + ::setColorButton(this->ui.colorButton, this->color); this->ui.positionX->setValue(reference->position().x()); this->ui.positionY->setValue(reference->position().y()); this->ui.positionZ->setValue(reference->position().z()); - connect( this->ui.colorButton, &QPushButton::clicked, @@ -26,7 +26,6 @@ ::setColorButton(this->ui.colorButton, this->color); } ); - for (int i : {0, 1, 2}) for (int j : {0, 1, 2}) {
--- a/src/linetypes/modelobject.cpp Sun Mar 18 12:33:29 2018 +0200 +++ b/src/linetypes/modelobject.cpp Sun Mar 18 12:37:40 2018 +0200 @@ -271,7 +271,10 @@ LDColor LDObject::color() const { - return m_color; + if (this->m_color.isValid()) + return this->m_color; + else + return this->defaultColor(); } QColor LDObject::randomColor() const @@ -324,6 +327,9 @@ // void LDObject::setColor (LDColor color) { + if (color == this->defaultColor()) + color = LDColor::nullColor; + changeProperty(&m_color, color); }
--- a/src/linetypes/modelobject.h Sun Mar 18 12:33:29 2018 +0200 +++ b/src/linetypes/modelobject.h Sun Mar 18 12:37:40 2018 +0200 @@ -98,7 +98,7 @@ private: bool m_hasInvertNext = false; bool m_isHidden; - LDColor m_color; + LDColor m_color = LDColor::nullColor; QColor m_randomColor; Vertex m_coords[4]; };