#include "CheckComboBoxWidgetFactory.h"
#include "CheckComboBoxWidget.h"

CheckComboBoxWidgetFactory::CheckComboBoxWidgetFactory()
{

}


void CheckComboBoxWidgetFactory::create(qx::IxDataMember *dataMember, QWidget *parent)
{
    widget = new CheckComboBoxWidget(parent);
    QVariantMap options;
    if (dataMember->getPropertyBag("dict").isValid())
    {
        options = dataMember->getPropertyBag("dict").toMap();
    }
    else
    {
        QString param = dataMember->getPropertyBag("param").toString();
        qx::any any = invokeStatic(dataMember, dataMember->getName() + "Options", param);
        if (any.empty())
            return;
        options = qx::any_cast<QVariantMap>(any);
    }
    widget->setOptions(options);
}

QString CheckComboBoxWidgetFactory::type() const
{
    return CheckComboBoxWidget::type;
}

QWidget *CheckComboBoxWidgetFactory::getWidget() const
{
    return widget;
}

IxWidget *CheckComboBoxWidgetFactory::getIxWidget() const
{
    return widget;
}
