# HG changeset patch # User Teemu Piippo # Date 1521369460 -7200 # Node ID b692088dc1a61052dcd0dbac051837fd469290fb # Parent dbc8bb2a4d8492ddb45aefc20e1b662edc5f396a fixed color handling diff -r dbc8bb2a4d84 -r b692088dc1a6 src/dialogs/subfilereferenceeditor.cpp --- 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}) { diff -r dbc8bb2a4d84 -r b692088dc1a6 src/linetypes/modelobject.cpp --- 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); } diff -r dbc8bb2a4d84 -r b692088dc1a6 src/linetypes/modelobject.h --- 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]; };