Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

void QAbstractFormBuilder::saveComboBoxExtraInfo ( QComboBox comboBox,
DomWidget *  ui_widget,
DomWidget *  ui_parentWidget 
) [protected, inherited]

For internal use only.

Definition at line 1924 of file abstractformbuilder.cpp.

References QList< T >::append(), QComboBox::count, QAbstractFormBuilder::iconToFilePath(), QAbstractFormBuilder::iconToQrcPath(), QString::isEmpty(), QIcon::isNull(), QComboBox::itemData(), and QComboBox::itemText().

Referenced by QAbstractFormBuilder::saveExtraInfo().

{
    Q_UNUSED(ui_parentWidget);

    QList<DomItem*> ui_items = ui_widget->elementItem();

    for (int i=0; i<comboBox->count(); ++i) {
        DomItem *ui_item = new DomItem();

        QList<DomProperty*> properties;

        // text
        DomString *str = new DomString;
        str->setText(comboBox->itemText(i));

        DomProperty *p = 0;

        p = new DomProperty;
        p->setAttributeName(QLatin1String("text"));
        p->setElementString(str);
        properties.append(p);

        QIcon icon = qVariantValue<QIcon>(comboBox->itemData(i));
        if (!icon.isNull()) {
            QString iconPath = iconToFilePath(icon);
            QString qrcPath = iconToQrcPath(icon);

            DomProperty *p = new DomProperty;

            DomResourcePixmap *pix = new DomResourcePixmap;
            if (!qrcPath.isEmpty())
                pix->setAttributeResource(qrcPath);

            pix->setText(iconPath);

            p->setAttributeName(QLatin1String("icon"));
            p->setElementIconSet(pix);

            properties.append(p);
        }

        ui_item->setElementProperty(properties);
        ui_items.append(ui_item);
    }

    ui_widget->setElementItem(ui_items);
}


Generated by  Doxygen 1.6.0   Back to index