Added ability to change initial color in color editor.
This commit is contained in:
parent
27ff6b3446
commit
6bac662ee8
|
@ -274,7 +274,9 @@ object_ptr<Ui::RpWidget> CreateGradientEditor(
|
||||||
buttonsContainer->chosenChanges(
|
buttonsContainer->chosenChanges(
|
||||||
) | rpl::start_with_next([=](ColorsLine::Chosen *chosen) {
|
) | rpl::start_with_next([=](ColorsLine::Chosen *chosen) {
|
||||||
if (chosen) {
|
if (chosen) {
|
||||||
editor->showColor(state->colors[chosen->index()]);
|
const auto color = state->colors[chosen->index()];
|
||||||
|
editor->showColor(color);
|
||||||
|
editor->setCurrent(color);
|
||||||
}
|
}
|
||||||
}, editor->lifetime());
|
}, editor->lifetime());
|
||||||
|
|
||||||
|
|
|
@ -1270,3 +1270,12 @@ void ColorEditor::setRGB(int red, int green, int blue, int alpha) {
|
||||||
updateHSBFields();
|
updateHSBFields();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorEditor::showColor(QColor color) {
|
||||||
|
updateFromColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColorEditor::setCurrent(QColor color) {
|
||||||
|
_current = color;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
|
@ -27,9 +27,8 @@ public:
|
||||||
[[nodiscard]] rpl::producer<QColor> colorValue() const;
|
[[nodiscard]] rpl::producer<QColor> colorValue() const;
|
||||||
[[nodiscard]] rpl::producer<> submitRequests() const;
|
[[nodiscard]] rpl::producer<> submitRequests() const;
|
||||||
|
|
||||||
void showColor(QColor color) {
|
void showColor(QColor color);
|
||||||
updateFromColor(color);
|
void setCurrent(QColor color);
|
||||||
}
|
|
||||||
|
|
||||||
void setInnerFocus() const;
|
void setInnerFocus() const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue