Ejemplo n.º 1
0
bool Q3ListViewExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
{
    // ### finish me
    Q3ListView *listView = qobject_cast<Q3ListView*>(widget());
    Q_ASSERT(listView != 0);

    QList<DomColumn*> columns;
    Q3Header *header = listView->header();
    for (int i=0; i<header->count(); ++i) {
        DomColumn *c = new DomColumn();

        QList<DomProperty*> properties;

        DomString *str = new DomString();
        str->setText(header->label(i));

        DomProperty *ptext = new DomProperty();
        ptext->setAttributeName(QLatin1String("text"));
        ptext->setElementString(str);

        DomProperty *pclickable = new DomProperty();
        pclickable->setAttributeName(QLatin1String("clickable"));
        pclickable->setElementBool(header->isClickEnabled(i) ? QLatin1String("true") : QLatin1String("false"));

        DomProperty *presizable = new DomProperty();
        presizable->setAttributeName(QLatin1String("resizable"));
        presizable->setElementBool(header->isResizeEnabled(i) ? QLatin1String("true") : QLatin1String("false"));

        properties.append(ptext);
        properties.append(pclickable);
        properties.append(presizable);

        c->setElementProperty(properties);
        columns.append(c);
    }

    ui_widget->setElementColumn(columns);

    QList<DomItem *> items;
    Q3ListViewItem *child = listView->firstChild();
    while (child) {
        items.append(saveQ3ListViewItem(child));
        child = child->nextSibling();
    }
    ui_widget->setElementItem(items);


    return true;
}
Ejemplo n.º 2
0
bool Q3TableExtraInfo::saveWidgetExtraInfo(DomWidget *ui_widget)
{
    Q_UNUSED(ui_widget);

    Q3Table *table = qobject_cast<Q3Table*>(widget());
    Q_ASSERT(table != 0);

    Q3Header *hHeader = table->horizontalHeader();

    QList<DomColumn*> columns;
    for (int i=0; i<hHeader->count(); ++i) {
        DomColumn *column = new DomColumn();
        QList<DomProperty *> properties;

        DomProperty *property = new DomProperty();
        DomString *string = new DomString();
        string->setText(hHeader->label(i));
        property->setElementString(string);
        property->setAttributeName("text");
        properties.append(property);

        column->setElementProperty(properties);
        columns.append(column);
    }
    ui_widget->setElementColumn(columns);

    Q3Header *vHeader = table->verticalHeader();

    QList<DomRow*> rows;
    for (int i=0; i<vHeader->count(); ++i) {
        DomRow *row = new DomRow();
        QList<DomProperty *> properties;

        DomProperty *property = new DomProperty();
        DomString *string = new DomString();
        string->setText(vHeader->label(i));
        property->setElementString(string);
        property->setAttributeName("text");
        properties.append(property);

        row->setElementProperty(properties);
        rows.append(row);
    }
    ui_widget->setElementRow(rows);

    return true;
}