mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Added to ColorEditor rpl value of current colors.
This commit is contained in:
parent
dff738f3c6
commit
5c3067d1f8
2 changed files with 9 additions and 0 deletions
|
@ -948,6 +948,10 @@ QColor ColorEditor::color() const {
|
|||
return _new.toRgb();
|
||||
}
|
||||
|
||||
rpl::producer<QColor> ColorEditor::colorValue() const {
|
||||
return _newChanges.events_starting_with_copy(_new);
|
||||
}
|
||||
|
||||
rpl::producer<> ColorEditor::submitRequests() const {
|
||||
return _submitRequests.events();
|
||||
}
|
||||
|
@ -1147,6 +1151,7 @@ QColor ColorEditor::applyLimits(QColor color) const {
|
|||
|
||||
void ColorEditor::updateFromColor(QColor color) {
|
||||
_new = applyLimits(color);
|
||||
_newChanges.fire_copy(_new);
|
||||
updateControlsFromColor();
|
||||
updateRGBFields();
|
||||
updateHSBFields();
|
||||
|
@ -1252,6 +1257,7 @@ void ColorEditor::setHSB(HSB hsb, int alpha) {
|
|||
} else {
|
||||
_new.setHsl(hsb.hue, hsb.saturation, hsb.brightness, alpha);
|
||||
}
|
||||
_newChanges.fire_copy(_new);
|
||||
updateRGBFields();
|
||||
updateResultField();
|
||||
update();
|
||||
|
@ -1259,6 +1265,7 @@ void ColorEditor::setHSB(HSB hsb, int alpha) {
|
|||
|
||||
void ColorEditor::setRGB(int red, int green, int blue, int alpha) {
|
||||
_new = applyLimits(QColor(red, green, blue, alpha));
|
||||
_newChanges.fire_copy(_new);
|
||||
updateControlsFromColor();
|
||||
updateHSBFields();
|
||||
update();
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
void setLightnessLimits(int min, int max);
|
||||
|
||||
[[nodiscard]] QColor color() const;
|
||||
[[nodiscard]] rpl::producer<QColor> colorValue() const;
|
||||
[[nodiscard]] rpl::producer<> submitRequests() const;
|
||||
|
||||
void showColor(QColor color) {
|
||||
|
@ -101,5 +102,6 @@ private:
|
|||
int _lightnessMax = 255;
|
||||
|
||||
rpl::event_stream<> _submitRequests;
|
||||
rpl::event_stream<QColor> _newChanges;
|
||||
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue