1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00

LibWeb: Allow input color to give continuous updates

This commit is contained in:
Bastiaan van der Plaat 2023-12-11 06:53:10 +01:00 committed by Andrew Kaster
parent cf69fd0a09
commit 0dd5aa40a8
13 changed files with 53 additions and 19 deletions

View file

@ -217,11 +217,14 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
dialog.setWindowTitle("Ladybird");
dialog.setOption(QColorDialog::ShowAlphaChannel, false);
QObject::connect(&dialog, &QColorDialog::currentColorChanged, this, [this](const QColor& color) {
view().color_picker_update(Color(color.red(), color.green(), color.blue()), Web::HTML::ColorPickerUpdateState::Update);
});
if (dialog.exec() == QDialog::Accepted)
view().color_picker_closed(Color(dialog.selectedColor().red(), dialog.selectedColor().green(), dialog.selectedColor().blue()));
view().color_picker_update(Color(dialog.selectedColor().red(), dialog.selectedColor().green(), dialog.selectedColor().blue()), Web::HTML::ColorPickerUpdateState::Closed);
else
view().color_picker_closed({});
view().color_picker_update({}, Web::HTML::ColorPickerUpdateState::Closed);
m_dialog = nullptr;
};