4 #include <QMetaProperty>
24 QVariant res = QVariant();
29 if (role == Qt::DisplayRole) {
30 if (index.isValid()) {
31 int r = index.row(), c = index.column();
39 }
else if (r < (pc+1)) {
41 QMetaProperty mp = obj->metaObject()->property(r-1);
45 res = obj->property(mp.name());
48 }
else if (r == (pc+1)) {
57 QString name = obj->dynamicPropertyNames().value(idx);
62 res = obj->property(qPrintable(name));
74 QVariant res = QVariant();
76 if (role == Qt::DisplayRole) {
77 if (orientation == Qt::Horizontal) {
80 }
else if (section == 1) {
83 }
else if (orientation == Qt::Vertical) {
89 }
else if (section < (pc+1)) {
91 }
else if (section == (pc+1)) {
94 return section - pc - 2;
107 return obj->metaObject()->propertyCount();
118 return obj->dynamicPropertyNames().count();
QcepDataObjectPropertiesModel(QcepDataObjectWPtr obj)
int propertyCount() const
int rowCount(const QModelIndex &parent=QModelIndex()) const
int columnCount(const QModelIndex &parent=QModelIndex()) const
QWeakPointer< QcepDataObject > QcepDataObjectWPtr
int dynamicPropertyCount() const
QSharedPointer< QcepDataObject > QcepDataObjectPtr
QcepDataObjectWPtr m_Object
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
QVariant headerData(int section, Qt::Orientation orientation, int role) const