bool Q3TableExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) { Q_UNUSED(ui_widget); Q3Table *table = qobject_cast<Q3Table*>(widget()); Q_ASSERT(table != 0); Q3Header *hHeader = table->horizontalHeader(); QList<DomColumn*> columns = ui_widget->elementColumn(); for (int i=0; i<columns.size(); ++i) { DomColumn *column = columns.at(i); QHash<QString, DomProperty*> properties = propertyMap(column->elementProperty()); DomProperty *text = properties.value(QLatin1String("text")); DomProperty *pixmap = properties.value(QLatin1String("pixmap")); QString txt = text->elementString()->text(); if (pixmap != 0) { DomResourcePixmap *pix = pixmap->elementPixmap(); QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); hHeader->setLabel(i, icon, txt); } else { hHeader->setLabel(i, txt); } } Q3Header *vHeader = table->verticalHeader(); QList<DomRow*> rows = ui_widget->elementRow(); for (int i=0; i<rows.size(); ++i) { DomRow *row = rows.at(i); QHash<QString, DomProperty*> properties = propertyMap(row->elementProperty()); DomProperty *text = properties.value(QLatin1String("text")); DomProperty *pixmap = properties.value(QLatin1String("pixmap")); QString txt = text->elementString()->text(); if (pixmap != 0) { DomResourcePixmap *pix = pixmap->elementPixmap(); QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); vHeader->setLabel(i, icon, txt); } else { vHeader->setLabel(i, txt); } } return true; }
bool Q3ListViewExtraInfo::loadWidgetExtraInfo(DomWidget *ui_widget) { Q3ListView *listView = qobject_cast<Q3ListView*>(widget()); Q_ASSERT(listView != 0); Q3Header *header = listView->header(); QList<DomColumn*> columns = ui_widget->elementColumn(); for (int i=0; i<columns.size(); ++i) { DomColumn *column = columns.at(i); QHash<QString, DomProperty*> properties = propertyMap(column->elementProperty()); DomProperty *text = properties.value(QLatin1String("text")); DomProperty *pixmap = properties.value(QLatin1String("pixmap")); DomProperty *clickable = properties.value(QLatin1String("clickable")); DomProperty *resizable = properties.value(QLatin1String("resizable")); QString txt = text->elementString()->text(); if (pixmap != 0) { DomResourcePixmap *pix = pixmap->elementPixmap(); QIcon icon(core()->iconCache()->resolveQrcPath(pix->text(), pix->attributeResource(), workingDirectory())); listView->addColumn(icon, txt); } else { listView->addColumn(txt); } if (clickable != 0) { header->setClickEnabled(clickable->elementBool() == QLatin1String("true"), header->count() - 1); } if (resizable != 0) { header->setResizeEnabled(resizable->elementBool() == QLatin1String("true"), header->count() - 1); } } if (ui_widget->elementItem().size()) { initializeQ3ListViewItems(ui_widget->elementItem()); } return true; }