MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / setData

Method setData

src/LanguageStylesModel.cpp:180–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180bool LanguageStylesModel::setData(const QModelIndex &index, const QVariant &value, int role)
181{
182 if (!index.isValid())
183 return false;
184
185 if (role == Qt::EditRole) {
186 switch (index.column()) {
187 case 4: // Font
188 editor->styleSetFont(index.row(), value.toString().toLatin1().constData());
189 break;
190 case 5: // Size
191 editor->styleSetSize(index.row(), value.toInt());
192 break;
193 case 6: // Fractional
194 editor->styleSetSizeFractional(index.row(), value.toInt());
195 break;
196 case 7: // Bold
197 editor->styleSetBold(index.row(), value.toBool());
198 break;
199 case 8: // Weight
200 editor->styleSetWeight(index.row(), value.toInt());
201 break;
202 case 9: // Italic
203 editor->styleSetItalic(index.row(), value.toBool());
204 break;
205 case 10: // Underline
206 editor->styleSetUnderline(index.row(), value.toBool());
207 break;
208 case 11: // Fore
209 editor->styleSetFore(index.row(), convert_color(value.value<QColor>().rgb()));
210 break;
211 case 12: // Back
212 editor->styleSetBack(index.row(), convert_color(value.value<QColor>().rgb()));
213 break;
214 case 13: // EOL Filled
215 editor->styleSetEOLFilled(index.row(), value.toBool());
216 break;
217 case 15: // Case
218 editor->styleSetCase(index.row(), value.toInt());
219 break;
220 case 16: // Visible
221 editor->styleSetVisible(index.row(), value.toBool());
222 break;
223 case 17: // Changeable
224 editor->styleSetChangeable(index.row(), value.toBool());
225 break;
226 case 18: // Hotspot
227 editor->styleSetHotSpot(index.row(), value.toBool());
228 break;
229 default:
230 return false;
231 }
232
233 editor->colourise(0, -1);
234
235 emit dataChanged(index, index, QVector<int>() << role);
236
237 return true;

Callers

nothing calls this directly

Calls 2

convert_colorFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected