| 100 | } |
| 101 | |
| 102 | QVariant LanguageStylesModel::data(const QModelIndex &index, int role) const |
| 103 | { |
| 104 | if (!index.isValid()) |
| 105 | return QVariant(); |
| 106 | |
| 107 | if (role == Qt::DisplayRole || role == Qt::ToolTipRole || role == Qt::EditRole) { |
| 108 | switch (index.column()) { |
| 109 | case 0: // ID |
| 110 | return QString::number(index.row()); |
| 111 | case 1: // Name |
| 112 | return editor->nameOfStyle(index.row()); |
| 113 | case 2: // Tags |
| 114 | return editor->tagsOfStyle(index.row()); |
| 115 | case 3: // Description |
| 116 | return editor->descriptionOfStyle(index.row()); |
| 117 | case 4: // Font |
| 118 | return editor->styleFont(index.row()); |
| 119 | case 5: // Size |
| 120 | return (int)editor->styleSize(index.row()); |
| 121 | case 6: // Fractional |
| 122 | return (int)editor->styleSizeFractional(index.row()); |
| 123 | case 7: // Bold |
| 124 | if (role == Qt::EditRole) return editor->styleBold(index.row()); |
| 125 | else return editor->styleBold(index.row()) ? "True" : "False"; |
| 126 | case 8: // Weight |
| 127 | return (int)editor->styleWeight(index.row()); |
| 128 | case 9: // Italic |
| 129 | if (role == Qt::EditRole) return editor->styleItalic(index.row()); |
| 130 | else return editor->styleItalic(index.row()) ? "True" : "False"; |
| 131 | case 10: // Underline |
| 132 | if (role == Qt::EditRole) return editor->styleUnderline(index.row()); |
| 133 | else return editor->styleUnderline(index.row()) ? "True" : "False"; |
| 134 | case 11: // Fore |
| 135 | return QColor(convert_color(editor->styleFore(index.row()))); |
| 136 | case 12: // Back |
| 137 | return QColor(convert_color(editor->styleBack(index.row()))); |
| 138 | case 13: // EOL Filled |
| 139 | if (role == Qt::EditRole) return editor->styleEOLFilled(index.row()); |
| 140 | else return editor->styleEOLFilled(index.row()) ? "True" : "False"; |
| 141 | case 14: // Character Set |
| 142 | return (int)editor->styleCharacterSet(index.row()); |
| 143 | case 15: // Case |
| 144 | if (role == Qt::EditRole) return (int)editor->styleCase(index.row()); |
| 145 | else return val_to_case_str(editor->styleCase(index.row())); |
| 146 | case 16: // Visible |
| 147 | if (role == Qt::EditRole) return editor->styleVisible(index.row()); |
| 148 | else return editor->styleVisible(index.row()) ? "True" : "False"; |
| 149 | case 17: // Changeable |
| 150 | if (role == Qt::EditRole) return editor->styleChangeable(index.row()); |
| 151 | else return editor->styleChangeable(index.row()) ? "True" : "False"; |
| 152 | case 18: // Hotspot |
| 153 | if (role == Qt::EditRole) return editor->styleHotSpot(index.row()); |
| 154 | else return editor->styleHotSpot(index.row()) ? "True" : "False"; |
| 155 | default: |
| 156 | break; |
| 157 | } |
| 158 | } |
| 159 | else if (role == Qt::TextAlignmentRole) { |
nothing calls this directly
no test coverage detected