// This code is auto-generated by Qul's qmltocpp tool from the file 'Screen01.ui.qml'
// WARNING! All changes made in this file will be lost!
#include "Screen01.h"
#include <qul/private/graphicsdevice.h>
#include <qul/private/filecache.h>

#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif

extern const Qul::Private::FontEngine * const qul_font_default_14_Normal_QualityDefault;
static const Qul::Private::String qulCurrentFileDir(".", 1);
extern Qul::Private::Items::ItemBase *loaderItemAllocator(const Qul::Private::String &uri, const Qul::Private::String &currentFileDir);

namespace Qul { namespace Private {
Qul::Property<int> &translationIndexProperty_main();
extern uint32_t qul_translation_base_offset_b18cf976976417ad800463f04017b966b9acaf53();
extern const char *qul_translation_string(int lang, uint32_t base, int entry);
}}


namespace {
#if defined(QUL_CC_IAR)
#pragma diag_suppress=Pe177 // declared but never referenced
#elif defined(QUL_CC_GNU)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
static Qul::Property<int> &translationIndexProperty() { return Qul::Private::translationIndexProperty_main(); }
static int translationIndex() { return translationIndexProperty().value(); }
static const char *qul_translation(int entry) {
    const uint32_t base_offset = Qul::Private::qul_translation_base_offset_b18cf976976417ad800463f04017b966b9acaf53();
    return Qul::Private::qul_translation_string(translationIndex(), base_offset, entry);
}
#if defined(QUL_CC_IAR)
#pragma diag_default=Pe177 // declared but never referenced
#elif defined(QUL_CC_GNU)
#pragma GCC diagnostic pop
#endif
}


int Screen01::anchor_functor::operator()(Screen01 *self, int _switch_index) const
{
    int properties[2] = {};

    switch(_switch_index) {
    case 0: properties[0] = self->width.value(); properties[1] = self->textLabel.width.value();  break;
    case 1: properties[0] = self->height.value(); properties[1] = self->textLabel.height.value();  break;
    }
    return int((int(properties[0]) + 1)/2 - ((properties[1])/2.0));
}

Qul::Private::String Screen01::Screen01_3108139282_bindingFunctor::operator()(Screen01 *self) const
{
    (void) self;
    QUL_DECL_UNUSED Qul::Private::String r2;
    // text: qsTr("Hello CrashWhenBuildingInRoot")
    // line 19  "Screen01.ui.qml"
    r2 = qul_translation(0);
    return r2;
    
}

Screen01::Screen01()

    : textLabel_x_anchor_binding(anchor_functor())
    , textLabel_y_anchor_binding(anchor_functor())
    , ExtraStorage_itemExtraProperties_this_instance(this)
    , ExtraStorage_rectangleExtraProperties_this_instance(this)
    , textLabel_text_binding(Screen01_3108139282_bindingFunctor())
{
    // color: Constants.backgroundColor
    // line 15  "Screen01.ui.qml"
    color.setValue(0xffe8e8e8);
#if __cplusplus < 201103L || defined(QUL_CC_IAR) || (defined(QUL_CC_GHS) && (__GHS_VERSION_NUMBER == 201714 || __GHS_VERSION_NUMBER == 201954))
    // height: Constants.height
    // line 14  "Screen01.ui.qml"
    height.setValue(480);
    // width: Constants.width
    // line 13  "Screen01.ui.qml"
    width.setValue(640);
#else
    using OffsetType14508472848368190223 = Qul::Private::Choose<uint16_t, uint32_t, (UINT16_MAX >
        Qul::Private::Max<offsetof(Screen01, height) / 4,
        Qul::Private::Max<offsetof(Screen01, width) / 4,
        0
        >::V>::V
        )>::Type;
    OffsetType14508472848368190223 propertyOffsets14508472848368190223[] = {
        std::is_same<decltype(height), Qul::Property<int>>::value ? (offsetof(Screen01, height) / 4) : std::numeric_limits<OffsetType14508472848368190223>::max(),
        std::is_same<decltype(width), Qul::Property<int>>::value ? (offsetof(Screen01, width) / 4) : std::numeric_limits<OffsetType14508472848368190223>::max(),
    };
    static constexpr int16_t propertyValues14508472848368190223[] = {
        // height: Constants.height
        // line 14  "Screen01.ui.qml"
        480,
        // width: Constants.width
        // line 13  "Screen01.ui.qml"
        640,
    };
    Qul::Private::initializeProperties<int>(this, propertyOffsets14508472848368190223, propertyValues14508472848368190223,
        sizeof(propertyOffsets14508472848368190223) / sizeof(propertyOffsets14508472848368190223[0]));
    // height: Constants.height
    // line 14  "Screen01.ui.qml"
    if (!std::is_same<decltype(height), Qul::Property<int>>::value)
        height.setValue(480);
    // width: Constants.width
    // line 13  "Screen01.ui.qml"
    if (!std::is_same<decltype(width), Qul::Property<int>>::value)
        width.setValue(640);
#endif
    // Text {
    // line 17  "Screen01.ui.qml"
    appendChild(this, &textLabel);
    // font.pixelSize: 14
    // line 21  "Screen01.ui.qml"
    textLabel.font.setValue(Qul::Private::FontPointer(qul_font_default_14_Normal_QualityDefault, NULL));
    textLabel_x_anchor_binding.init<Screen01, &Screen01::textLabel_x_anchor_binding, 0>(textLabel.x);
    textLabel.x.setBinding(&textLabel_x_anchor_binding);
    textLabel_y_anchor_binding.init<Screen01, &Screen01::textLabel_y_anchor_binding, 1>(textLabel.y);
    textLabel.y.setBinding(&textLabel_y_anchor_binding);
    textLabel_text_binding.init<Screen01, &Screen01::textLabel_text_binding>(textLabel.text);
    // text: qsTr("Hello CrashWhenBuildingInRoot")
    // line 19  "Screen01.ui.qml"
    textLabel.text.setBinding (&textLabel_text_binding);
}

