C++: fix creating a gradient from a const reference to a color

This commit is contained in:
Olivier Goffart 2021-07-22 14:24:41 +02:00
parent c2433d0f0b
commit 0a46b367e2
2 changed files with 5 additions and 1 deletions

View file

@ -177,7 +177,7 @@ public:
#if !defined(DOXYGEN) #if !defined(DOXYGEN)
// FIXME: we need this to create GradientStop // FIXME: we need this to create GradientStop
operator const cbindgen_private::types::Color &() { return inner; } operator const cbindgen_private::types::Color &() const { return inner; }
#endif #endif
private: private:

View file

@ -14,5 +14,9 @@ Test := Rectangle {
background: @linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%); background: @linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
property <color> foo: #a23; property <color> foo: #a23;
property <brush> bar: @linear-gradient(1.2rad, foo.darker(0.5), foo.brighter(0.5), ); property <brush> bar: @linear-gradient(1.2rad, foo.darker(0.5), foo.brighter(0.5), );
for data in [{xx: #b56}] : Rectangle {
background: @linear-gradient(1.2rad, data.xx, blue);
}
} }