1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +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

@ -12,7 +12,7 @@
#include <LibGUI/Label.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Slider.h>
#include <LibGUI/ValueSlider.h>
namespace PixelPaint {
@ -77,15 +77,12 @@ GUI::Widget* PenTool::get_properties_widget()
thickness_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
thickness_label.set_fixed_size(80, 20);
auto& thickness_slider = thickness_container.add<GUI::HorizontalSlider>();
thickness_slider.set_fixed_height(20);
auto& thickness_slider = thickness_container.add<GUI::ValueSlider>(Orientation::Horizontal, "px");
thickness_slider.set_range(1, 20);
thickness_slider.set_value(m_thickness);
thickness_slider.set_tooltip(String::formatted("{}px", m_thickness));
thickness_slider.on_change = [&](int value) {
m_thickness = value;
thickness_slider.set_tooltip(String::formatted("{}px", value));
};
}