Change the way Text's default color is implemented

Instead of via an item constructor, implement support for default
bindings in the compiler.
This commit is contained in:
Simon Hausmann 2020-09-16 10:49:59 +02:00
parent 04e2910344
commit ad77896312
8 changed files with 87 additions and 48 deletions

View file

@ -368,11 +368,6 @@ Flickable::~Flickable()
sixtyfps_flickable_data_free(&data);
}
Text::Text()
{
sixtyfps_text_init(this);
}
namespace private_api {
template<int Major, int Minor, int Patch>
struct VersionCheckHelper

View file

@ -145,6 +145,15 @@ public:
/// false otherwise.
friend bool operator!=(const Color &lhs, const Color &rhs) { return !(lhs == rhs); }
/// Writes the \a color to the specified \a stream and returns a reference to the
/// stream.
friend std::ostream &operator<<(std::ostream &stream, const Color &color)
{
// Cast to uint to avoid the components being interpreted as char.
return stream << "argb(" << uint(color.inner.alpha) << ", " << uint(color.inner.red) << ", "
<< uint(color.inner.green) << ", " << uint(color.inner.blue) << ")";
}
private:
cbindgen_private::types::Color inner;
};