MCPcopy Create free account
hub / github.com/YACReader/yacreader / editColorItem

Method editColorItem

common/themes/theme_editor_dialog.cpp:227–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227void ThemeEditorDialog::editColorItem(QTreeWidgetItem *item)
228{
229 const QColor current(item->text(1));
230 QColorDialog dialog(current, this);
231 dialog.setOption(QColorDialog::ShowAlphaChannel, true);
232 dialog.setWindowTitle(tr("Edit: %1").arg(item->text(0)));
233
234 // Live update as user drags the picker
235 connect(&dialog, &QColorDialog::currentColorChanged, this, [this, item](const QColor &color) {
236 applyColorToItem(item, color);
237 emit themeJsonChanged(params);
238 });
239
240 if (dialog.exec() == QDialog::Accepted) {
241 applyColorToItem(item, dialog.selectedColor());
242 } else {
243 // Revert to original if cancelled
244 applyColorToItem(item, current);
245 }
246 emit themeJsonChanged(params);
247}
248
249void ThemeEditorDialog::applyColorToItem(QTreeWidgetItem *item, const QColor &color)
250{

Callers

nothing calls this directly

Calls 3

textMethod · 0.80
execMethod · 0.80
selectedColorMethod · 0.80

Tested by

no test coverage detected