| 254 | } |
| 255 | |
| 256 | void ColorPickerPopup::onHexCommitted() { |
| 257 | QString text = hex_edit_->text().trimmed(); |
| 258 | if (!text.startsWith('#')) { |
| 259 | text.prepend('#'); |
| 260 | } |
| 261 | if (text.size() != 7) { |
| 262 | pushToHexField(color()); |
| 263 | return; |
| 264 | } |
| 265 | const QColor c(text); |
| 266 | if (!c.isValid()) { |
| 267 | pushToHexField(color()); |
| 268 | return; |
| 269 | } |
| 270 | setColor(c); |
| 271 | emit colorChanged(c); |
| 272 | } |
| 273 | |
| 274 | void ColorPickerPopup::recomputeAndEmit() { |
| 275 | const QColor c = color(); |