QtnPropertyDelegateQRect::QtnPropertyDelegateQRect(QtnPropertyQRectBase& owner)
    : QtnPropertyDelegateTypedEx<QtnPropertyQRectBase>(owner)
{
    addSubProperty(qtnCreateLeftProperty(0, &owner));
    addSubProperty(qtnCreateTopProperty(0, &owner));
    addSubProperty(qtnCreateWidthProperty(0, &owner));
    addSubProperty(qtnCreateHeightProperty(0, &owner));
}
QtnPropertyDelegateQFont::QtnPropertyDelegateQFont(QtnPropertyQFontBase& owner)
    : QtnPropertyDelegateTypedEx<QtnPropertyQFontBase>(owner)
{
    QtnPropertyQStringCallback* propertyFamily = new QtnPropertyQStringCallback(0);
    addSubProperty(propertyFamily);
    propertyFamily->setName(owner.tr("Family"));
    propertyFamily->setDescription(owner.tr("Font Family for %1.").arg(owner.name()));
    propertyFamily->setCallbackValueGet([&owner]()->QString {
        return owner.value().family();
    });
    propertyFamily->setCallbackValueSet([&owner](QString value) {
        QFont font = owner.value();
        font.setFamily(value);
        owner.setValue(font);
    });
    QtnPropertyDelegateInfo delegate;
    delegate.name = "List";
    QFontDatabase fDB;
    delegate.attributes["items"] = fDB.families();
    propertyFamily->setDelegate(delegate);

    QtnPropertyUIntCallback* propertyPointSize = new QtnPropertyUIntCallback(0);
    addSubProperty(propertyPointSize);
    propertyPointSize->setName(owner.tr("PointSize"));
    propertyPointSize->setDescription(owner.tr("Point size for %1.").arg(owner.name()));
    propertyPointSize->setCallbackValueGet([&owner]()->quint32 {
        int ps = owner.value().pointSize();
        return ps != -1 ? ps : 1;
    });
    propertyPointSize->setCallbackValueSet([&owner](quint32 value) {
        QFont font = owner.value();
        font.setPointSize((int)value);
        owner.setValue(font);
    });
    propertyPointSize->setMinValue(1);
    propertyPointSize->setMaxValue((quint32)std::numeric_limits<int>::max());

    QtnPropertyBoolCallback* propertyBold = new QtnPropertyBoolCallback(0);
    addSubProperty(propertyBold);
    propertyBold->setName(owner.tr("Bold"));
    propertyBold->setDescription(owner.tr("Bold flag for %1").arg(owner.name()));
    propertyBold->setCallbackValueGet([&owner]()->bool {
        return owner.value().bold();
    });
    propertyBold->setCallbackValueSet([&owner](bool value) {
        QFont font = owner.value();
        font.setBold(value);
        owner.setValue(font);
    });

    QtnPropertyBoolCallback* propertyItalic = new QtnPropertyBoolCallback(0);
    addSubProperty(propertyItalic);
    propertyItalic->setName(owner.tr("Italic"));
    propertyItalic->setDescription(owner.tr("Italic flag for %1").arg(owner.name()));
    propertyItalic->setCallbackValueGet([&owner]()->bool {
        return owner.value().italic();
    });
    propertyItalic->setCallbackValueSet([&owner](bool value) {
        QFont font = owner.value();
        font.setItalic(value);
        owner.setValue(font);
    });

    QtnPropertyBoolCallback* propertyUnderline = new QtnPropertyBoolCallback(0);
    addSubProperty(propertyUnderline);
    propertyUnderline->setName(owner.tr("Underline"));
    propertyUnderline->setDescription(owner.tr("Underline flag for %1").arg(owner.name()));
    propertyUnderline->setCallbackValueGet([&owner]()->bool {
        return owner.value().underline();
    });
    propertyUnderline->setCallbackValueSet([&owner](bool value) {
        QFont font = owner.value();
        font.setUnderline(value);
        owner.setValue(font);
    });

    QtnPropertyBoolCallback* propertyStrikeout = new QtnPropertyBoolCallback(0);
    addSubProperty(propertyStrikeout);
    propertyStrikeout->setName(owner.tr("Strikeout"));
    propertyStrikeout->setDescription(owner.tr("Strikeout flag for %1").arg(owner.name()));
    propertyStrikeout->setCallbackValueGet([&owner]()->bool {
        return owner.value().strikeOut();
    });
    propertyStrikeout->setCallbackValueSet([&owner](bool value) {
        QFont font = owner.value();
        font.setStrikeOut(value);
        owner.setValue(font);
    });

    QtnPropertyBoolCallback* propertyKerning = new QtnPropertyBoolCallback(0);
    addSubProperty(propertyKerning);
    propertyKerning->setName(owner.tr("Kerning"));
    propertyKerning->setDescription(owner.tr("Kerning flag for %1").arg(owner.name()));
    propertyKerning->setCallbackValueGet([&owner]()->bool {
        return owner.value().kerning();
    });
    propertyKerning->setCallbackValueSet([&owner](bool value) {
        QFont font = owner.value();
        font.setKerning(value);
        owner.setValue(font);
    });

    QtnPropertyEnumCallback* propertyAntialiasing = new QtnPropertyEnumCallback(0);
    addSubProperty(propertyAntialiasing);
    propertyAntialiasing->setName(owner.tr("Antialiasing"));
    propertyAntialiasing->setDescription(owner.tr("Antialiasing flag for %1.").arg(owner.name()));
    propertyAntialiasing->setEnumInfo(styleStrategyEnum());
    propertyAntialiasing->setCallbackValueGet([&owner]()->QtnEnumValueType {
        return owner.value().styleStrategy();
    });
    propertyAntialiasing->setCallbackValueSet([&owner](QtnEnumValueType value) {
        QFont font = owner.value();
        font.setStyleStrategy((QFont::StyleStrategy)value);
        owner.setValue(font);
    });
}
QtnPropertyDelegateQPointF::QtnPropertyDelegateQPointF(QtnPropertyQPointFBase& owner)
    : QtnPropertyDelegateTypedEx<QtnPropertyQPointFBase>(owner)
{
    addSubProperty(qtnCreateXProperty(0, &owner));
    addSubProperty(qtnCreateYProperty(0, &owner));
}