1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

PixelPaint: Use the ValueSlider widget for Tool properties

Use the new ValueSlider and get rid of the temporary solution with
tooltips :^)
This commit is contained in:
Marcus Nilsson 2021-08-05 19:36:38 +02:00 committed by Andreas Kling
parent 07ad64da8c
commit 868be680c2
10 changed files with 23 additions and 57 deletions

View file

@ -11,7 +11,7 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Label.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Slider.h>
#include <LibGUI/ValueSlider.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Rect.h>
@ -98,15 +98,12 @@ GUI::Widget* BucketTool::get_properties_widget()
threshold_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
threshold_label.set_fixed_size(80, 20);
auto& threshold_slider = threshold_container.add<GUI::HorizontalSlider>();
threshold_slider.set_fixed_height(20);
auto& threshold_slider = threshold_container.add<GUI::ValueSlider>(Orientation::Horizontal, "%");
threshold_slider.set_range(0, 100);
threshold_slider.set_value(m_threshold);
threshold_slider.set_tooltip(String::formatted("{}%", m_threshold));
threshold_slider.on_change = [&](int value) {
m_threshold = value;
threshold_slider.set_tooltip(String::formatted("{}%", value));
};
}