当前位置: 首页>>代码示例>>C++>>正文


C++ DataItem::addSubitem方法代码示例

本文整理汇总了C++中DataItem::addSubitem方法的典型用法代码示例。如果您正苦于以下问题:C++ DataItem::addSubitem方法的具体用法?C++ DataItem::addSubitem怎么用?C++ DataItem::addSubitem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataItem的用法示例。


在下文中一共展示了DataItem::addSubitem方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addItem

void VInfoRequest::addItem(DataType type, DataItem &group, const QVariant &data) const
{
    DataItem item(names()->at(type), titles()->at(type), data);
    if (type == BDate && data.canConvert<QDate>()
            && data.value<QDate>().year() == 1900)
        item.setProperty("hideYear", true);
    group.addSubitem(item);
}
开发者ID:Anderty,项目名称:qutim,代码行数:8,代码来源:vinforequest.cpp

示例2: filterItems

DataItem QuickContactInfo::filterItems(const DataItem &item, bool readOnly)
{
    DataItem result = item;
    result.setSubitems(QList<DataItem>());
    foreach (const DataItem &subitem, item.subitems()) {
        if (subitem.isAllowedModifySubitems()) {
            if (!readOnly || subitem.hasSubitems())
                result.addSubitem(subitem);
        } else if (subitem.hasSubitems()) {
            filterItemsHelper(subitem, result, readOnly);
        } else {
            if (readOnly && isItemEmpty(subitem))
                continue;
            result.addSubitem(subitem);
        }
    }
    return result;
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:18,代码来源:quickcontactinfo.cpp

示例3: onSaveButton

void MainWindow::onSaveButton()
{
    DataItem items;
    if (avatarWidget) {
        DataItem avatarItem = avatarWidget->item();
        items.addSubitem(avatarItem);
    }
    for (int i = 0; i < ui.detailsStackedWidget->count(); ++i) {
        QWidget *widget = ui.detailsStackedWidget->widget(i);
        Q_ASSERT(qobject_cast<QScrollArea*>(widget));
        QScrollArea *scrollArea = static_cast<QScrollArea*>(widget);
        AbstractDataForm *dataFrom = qobject_cast<AbstractDataForm*>(scrollArea->widget());
        if (!dataFrom)
            continue;
        if (dataFrom->objectName() == "General") {
            foreach (const DataItem &item, dataFrom->item().subitems())
                items.addSubitem(item);
        } else {
开发者ID:ramainen,项目名称:qutim,代码行数:18,代码来源:contactinfo.cpp

示例4: filterItemsHelper

void QuickContactInfo::filterItemsHelper(const DataItem &item, DataItem &result, bool readOnly)
{
    Q_ASSERT(item.hasSubitems());
    DataItem group = item;
    group.setSubitems(QList<DataItem>());
    foreach (const DataItem &subitem, item.subitems()) {
        if (subitem.isAllowedModifySubitems()) {
            if (!readOnly || subitem.hasSubitems())
                result.addSubitem(subitem);
        } else if (subitem.hasSubitems()) {
            filterItemsHelper(subitem, result, readOnly);
        } else {
            if (readOnly && isItemEmpty(subitem))
                continue;
            group.addSubitem(subitem);
        }
    }
    if (group.hasSubitems())
        result.addSubitem(group);
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:20,代码来源:quickcontactinfo.cpp

示例5: createDataItem

DataItem VInfoRequest::createDataItem() const
{
    DataItem item;
    // General page
    {
        DataItem general(QT_TRANSLATE_NOOP("ContactInfo", "General"));
        {
            DataItem person(QT_TRANSLATE_NOOP("ContactInfo", "Person"));
            addItem(NickName, person, "nickname");
            addItem(FirstName, person, "first_name");
            addItem(LastName, person, "last_name");
            addItem(Sex, person, genders()->value(m_data.value("sex", 0).toInt()).toString());
            QString bdate = m_data.value("bdate").toString();
            QDate birthday;
            if (bdate.count('.') == 2)
                birthday = QDate::fromString(bdate, "d.M.yyyy");
            else if (bdate.count('.') == 1)
                birthday = QDate::fromString(bdate, "d.M");
            addItem(BDate, person, birthday);
            general.addSubitem(person);
        }
        {
            DataItem address(QT_TRANSLATE_NOOP("ContactInfo", "Home address"));
            addItem(Country, address, "country");
            addItem(City, address, "city");
            addItem(HomePhone, address, "home_phone");
            addItem(MobilePhone, address, "mobile_phone");
            general.addSubitem(address);
        }
        {
            DataItem education(QT_TRANSLATE_NOOP("ContactInfo", "Education"));
            addItem(University, education, "university_name");
            addItem(Faculty, education, "faculty_name");
            addItem(Graduation, education, "graduation");
            general.addSubitem(education);
        }
        item.addSubitem(general);
    }
    return item;
}
开发者ID:Anderty,项目名称:qutim,代码行数:40,代码来源:vinforequest.cpp

示例6: item

QuetzalFieldsDialog::QuetzalFieldsDialog(const char *title, const char *primary,
                                         const char *secondary, PurpleRequestFields *fields,
                                         const char *ok_text, GCallback ok_cb,
                                         const char *cancel_text, GCallback cancel_cb,
                                         void *user_data, QWidget *parent)
                                             : QuetzalRequestDialog(PURPLE_REQUEST_FIELDS, user_data, parent)
{
    m_ok_cb = (PurpleRequestFieldsCb) ok_cb;
    m_cancel_cb = (PurpleRequestFieldsCb) cancel_cb;
    m_fields = fields;
    DataItem root = createItem(title, primary, secondary);
    GList *group_it = purple_request_fields_get_groups(m_fields);
    bool useGroupBox = group_it->next;
    debug() << "useGroupBox" << useGroupBox;
    for (; group_it; group_it = group_it->next) {
        PurpleRequestFieldGroup *group = reinterpret_cast<PurpleRequestFieldGroup*>(group_it->data);
        DataItem groupItem;
        if (useGroupBox)
            groupItem = DataItem(purple_request_field_group_get_title(group));
        GList *field_it = purple_request_field_group_get_fields(group);
        for (; field_it; field_it = field_it->next) {
            PurpleRequestField *field = reinterpret_cast<PurpleRequestField*>(field_it->data);
            debug() << field->id << purple_request_field_is_visible(field)
                    << purple_request_field_get_type(field);
            if (!purple_request_field_is_visible(field))
                continue;
            DataItem item(purple_request_field_get_id(field),
                          purple_request_field_get_label(field),
                          QVariant());
            switch (purple_request_field_get_type(field)) {
            case PURPLE_REQUEST_FIELD_STRING:
                item.setData(QString::fromUtf8(purple_request_field_string_get_default_value(field)));
                item.setProperty("multiline", purple_request_field_string_is_multiline(field));
                item.setProperty("password", bool(purple_request_field_string_is_masked(field)));
                item.setReadOnly(!purple_request_field_string_is_editable(field));
                debug() << item.name() << item.data() << item.property("password") << item.isReadOnly();
                break;
            case PURPLE_REQUEST_FIELD_INTEGER:
                item.setData(purple_request_field_int_get_default_value(field));
                item.setProperty("minValue", G_MININT);
                item.setProperty("maxValue", G_MAXINT);
                break;
            case PURPLE_REQUEST_FIELD_BOOLEAN:
                item.setData(bool(purple_request_field_bool_get_default_value(field)));
                break;
            case PURPLE_REQUEST_FIELD_CHOICE:
                {
                    GList *labels = purple_request_field_choice_get_labels(field);
                    QStringList alternatives;
                    for (; labels; labels = labels->next)
                        alternatives << QString::fromUtf8(reinterpret_cast<char*>(labels->data));
                    item.setData(alternatives.value(purple_request_field_choice_get_default_value(field)));
                    item.setProperty("alternatives", alternatives);
                }
                break;
            case PURPLE_REQUEST_FIELD_LIST:
                break;
            case PURPLE_REQUEST_FIELD_LABEL:
                item.setData(purple_request_field_get_label(field));
                item.setReadOnly(true);
                item.setProperty("hideTitle", true);
                break;
            case PURPLE_REQUEST_FIELD_IMAGE:
                {
                    QImageReader reader;
                    QByteArray data = QByteArray::fromRawData(purple_request_field_image_get_buffer(field),
                                                              purple_request_field_image_get_size(field));
                    QBuffer buffer(&data);
                    reader.setDevice(&buffer);
                    QSize imageSize = reader.size();
                    if (imageSize.isValid()) {
                        imageSize.setWidth(imageSize.width() * purple_request_field_image_get_scale_x(field));
                        imageSize.setHeight(imageSize.height() * purple_request_field_image_get_scale_y(field));
                        reader.setScaledSize(imageSize);
                    }
                    item.setData(qVariantFromValue(reader.read()));
                    item.setProperty("imageSize", qVariantFromValue(imageSize));
                    item.setReadOnly(true);
                }
                break;
            case PURPLE_REQUEST_FIELD_ACCOUNT:
                break;
            case PURPLE_REQUEST_FIELD_NONE:
            default:
                continue;
            }
            item.setProperty("mandatory", purple_request_field_is_required(field));
            if (useGroupBox)
                groupItem.addSubitem(item);
            else
                root.addSubitem(item);
        }
        if (useGroupBox)
            root.addSubitem(groupItem);
    }
    createItem(root, ok_text, cancel_text);
    return;
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:98,代码来源:quetzalfieldsdialog.cpp


注:本文中的DataItem::addSubitem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。