| 288 | } |
| 289 | |
| 290 | void ColorTable::onColorActivated() |
| 291 | { |
| 292 | const auto rows = selectionModel()->selectedRows(); |
| 293 | if (rows.isEmpty()) { |
| 294 | return; |
| 295 | } |
| 296 | |
| 297 | const auto row = rows[0].row(); |
| 298 | auto* ci = colorItemForRow(this, row); |
| 299 | if (!ci) { |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | const QColor result = QColorDialog::getColor( |
| 304 | ci->get(), topLevelWidget(), ci->caption(), QColorDialog::ShowAlphaChannel); |
| 305 | |
| 306 | if (result.isValid()) { |
| 307 | ci->set(result); |
| 308 | update(model()->index(row, 1)); |
| 309 | } |
| 310 | } |