| 52 | } |
| 53 | |
| 54 | QVariant TextDocumentFormatModel::data(const QModelIndex &index, int role) const |
| 55 | { |
| 56 | if (!index.isValid()) |
| 57 | return QVariant(); |
| 58 | |
| 59 | if (role == Qt::DisplayRole) { |
| 60 | const int enumValue = propertyEnum().value(index.row()); |
| 61 | switch (index.column()) { |
| 62 | case 0: |
| 63 | return QString::fromLatin1(propertyEnum().key(index.row())); |
| 64 | case 1: |
| 65 | return VariantHandler::displayString(m_format.property(enumValue)); |
| 66 | case 2: |
| 67 | return QString::fromLatin1(m_format.property(enumValue).typeName()); |
| 68 | } |
| 69 | } else if (role == Qt::DecorationRole && index.column() == 1) { |
| 70 | const int enumValue = propertyEnum().value(index.row()); |
| 71 | return VariantHandler::decoration(m_format.property(enumValue)); |
| 72 | } |
| 73 | |
| 74 | return QVariant(); |
| 75 | } |
| 76 | |
| 77 | QVariant TextDocumentFormatModel::headerData(int section, Qt::Orientation orientation, |
| 78 | int role) const |