1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 18:55:08 +00:00

GSpinBox: Move increment/decrement button within the widget frame.

This commit is contained in:
Andreas Kling 2019-04-10 02:09:06 +02:00
parent 9311164439
commit 5ab043a687

View file

@ -63,9 +63,10 @@ void GSpinBox::set_range(int min, int max)
void GSpinBox::resize_event(GResizeEvent& event)
{
int button_height = event.size().height() / 2;
int frame_thickness = m_editor->frame_thickness();
int button_height = (event.size().height() / 2) - frame_thickness;
int button_width = 15;
m_increment_button->set_relative_rect(width() - button_width, 0, button_width, button_height);
m_decrement_button->set_relative_rect(width() - button_width, button_height, button_width, button_height);
m_editor->set_relative_rect(0, 0, width() - button_width, height());
m_increment_button->set_relative_rect(width() - button_width - frame_thickness, frame_thickness, button_width, button_height);
m_decrement_button->set_relative_rect(width() - button_width - frame_thickness, frame_thickness + button_height, button_width, button_height);
m_editor->set_relative_rect(0, 0, width(), height());
}