Skip to content

Commit

Permalink
GSpinBox: Move increment/decrement button within the widget frame.
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Apr 10, 2019
1 parent 9311164 commit 5ab043a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions LibGUI/GSpinBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

0 comments on commit 5ab043a

Please sign in to comment.