QWidget* LimeReport::DatasourcePropItem::createProperyEditor(QWidget *parent) const{
    ComboBoxEditor *editor = new ComboBoxEditor(parent,true);
    editor->setEditable(true);
    LimeReport::BaseDesignIntf *item=dynamic_cast<LimeReport::BaseDesignIntf*>(object());
    if (item){
       editor->addItems(item->reportEditor()->dataManager()->dataSourceNames());
    }
    return editor;
}
QWidget *LimeReport::FieldPropItem::createProperyEditor(QWidget *parent) const
{
    ComboBoxEditor *editor = new ComboBoxEditor(parent);
    editor->setEditable(true);
    LimeReport::BaseDesignIntf *item=dynamic_cast<LimeReport::BaseDesignIntf*>(object());
    int propertyIndex = object()->metaObject()->indexOfProperty("datasource");

    if (item && propertyIndex>0){
       editor->addItems(item->reportEditor()->dataManager()->fieldNames(object()->property("datasource").toString()));
    }
    return editor;
}
QWidget *GroupFieldPropItem::createProperyEditor(QWidget *parent) const
{
    ComboBoxEditor *editor = new ComboBoxEditor(parent,true);
    editor->setEditable(true);
    GroupBandHeader *item=dynamic_cast<GroupBandHeader*>(object());
    if (item){
        DataBandDesignIntf* dataBand = dynamic_cast<DataBandDesignIntf*>(item->parentBand());
        if (dataBand){
            int propertyIndex = dataBand->metaObject()->indexOfProperty("datasource");

            if (item && propertyIndex>0){
               editor->addItems(item->reportEditor()->dataManager()->fieldNames(dataBand->property("datasource").toString()));
            }
        }
    }
    return editor;
}
Example #4
0
QWidget *EnumPropItem::createProperyEditor(QWidget *parent) const
{
    ComboBoxEditor *editor = new ComboBoxEditor(parent,false);
    connect(editor,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotEnumChanged(QString)));

    QStringList enumValues;
    QMetaEnum propEnum = object()->metaObject()->property(object()->metaObject()->indexOfProperty(propertyName().toLatin1())).enumerator();
    for (int i=0;i<propEnum.keyCount();i++){
        if (m_acceptableValues.isEmpty()) enumValues.append(propEnum.key(i));
        else {
            if (m_acceptableValues.contains(propEnum.value(i))){
                enumValues.append(propEnum.key(i));
            }
        }
    }
    editor->addItems(enumValues);
    return editor;
}