| 225 | } |
| 226 | |
| 227 | void 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 | |
| 249 | void ThemeEditorDialog::applyColorToItem(QTreeWidgetItem *item, const QColor &color) |
| 250 | { |
nothing calls this directly
no test coverage detected