Added ability to change initial color in color editor.

This commit is contained in:
23rd 2023-01-25 22:53:35 +03:00 committed by John Preston
parent 27ff6b3446
commit 6bac662ee8
3 changed files with 14 additions and 4 deletions

View File

@ -274,7 +274,9 @@ object_ptr<Ui::RpWidget> CreateGradientEditor(
buttonsContainer->chosenChanges(
) | rpl::start_with_next([=](ColorsLine::Chosen *chosen) {
if (chosen) {
editor->showColor(state->colors[chosen->index()]);
const auto color = state->colors[chosen->index()];
editor->showColor(color);
editor->setCurrent(color);
}
}, editor->lifetime());

View File

@ -1270,3 +1270,12 @@ void ColorEditor::setRGB(int red, int green, int blue, int alpha) {
updateHSBFields();
update();
}
void ColorEditor::showColor(QColor color) {
updateFromColor(color);
}
void ColorEditor::setCurrent(QColor color) {
_current = color;
update();
}

View File

@ -27,9 +27,8 @@ public:
[[nodiscard]] rpl::producer<QColor> colorValue() const;
[[nodiscard]] rpl::producer<> submitRequests() const;
void showColor(QColor color) {
updateFromColor(color);
}
void showColor(QColor color);
void setCurrent(QColor color);
void setInnerFocus() const;