void QtPropertyItem::ChildAdd(const QString &key, QtPropertyData* data) { if(NULL != parentName) { QList<QStandardItem *> subItems; QtPropertyItem *subName = new QtPropertyItem(key); QtPropertyItem *subValue = new QtPropertyItem(data, subName); subValue->itemDataDeleteByParent = true; // subValue->setFont(QFont("Courier")); subName->setEditable(false); subItems.append(subName); subItems.append(subValue); parentName->appendRow(subItems); } }
QPair<QtPropertyItem*, QtPropertyItem*> QtPropertyModel::AppendProperty(const QString &name, QtPropertyData* data, QtPropertyItem* parent /*= NULL*/) { QList<QStandardItem *> items; QStandardItem* root = (QStandardItem *) parent; QtPropertyItem *newPropertyName = new QtPropertyItem(name); QtPropertyItem *newPropertyValue = new QtPropertyItem(data, newPropertyName); newPropertyName->setEditable(false); items.append(newPropertyName); items.append(newPropertyValue); if(NULL == root) { root = invisibleRootItem(); } root->appendRow(items); return QPair<QtPropertyItem*, QtPropertyItem*>(newPropertyName, newPropertyValue); }