Skip to content

Commit

Permalink
add delete button to "AddHill" menu button
Browse files Browse the repository at this point in the history
  • Loading branch information
MrWh1teF0x committed Apr 30, 2024
1 parent 540ca87 commit 6100681
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
10 changes: 10 additions & 0 deletions main/add_objects_forms/add_hill_form.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,13 @@ void AddHillForm::AddNewInputFields(size_t amount) {
PointLineEdits(abscissa_line_edit, ordinate_line_edit));
}
}

void AddHillForm::on_deletePushButton_clicked() {
if (both_coords_point_line_edits_.size() > 3) {
both_coords_point_line_edits_.erase(both_coords_point_line_edits_.begin() +
both_coords_point_line_edits_.size() -
1);
point_layouts_widgets_.erase(point_layouts_widgets_.begin() +
point_layouts_widgets_.size() - 1);
}
}
1 change: 1 addition & 0 deletions main/add_objects_forms/add_hill_form.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class AddHillForm : public QDialog {
void on_createPushButton_clicked();
void on_clearPushButton_clicked();
void on_newPushButton_clicked();
void on_deletePushButton_clicked();

private:
/**
Expand Down
26 changes: 19 additions & 7 deletions main/add_objects_forms/add_hill_form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>280</width>
<width>420</width>
<height>310</height>
</rect>
</property>
Expand All @@ -24,7 +24,7 @@
</property>
<property name="maximumSize">
<size>
<width>280</width>
<width>500</width>
<height>310</height>
</size>
</property>
Expand All @@ -44,10 +44,10 @@
<widget class="QScrollArea" name="scrollArea">
<property name="geometry">
<rect>
<x>0</x>
<x>10</x>
<y>0</y>
<width>280</width>
<height>310</height>
<width>401</width>
<height>311</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -64,8 +64,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>278</width>
<height>308</height>
<width>399</width>
<height>309</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -111,6 +111,18 @@ QPushButton::pressed{background-color: rgb(135, 135, 135);}
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deletePushButton">
<property name="styleSheet">
<string notr="true">QPushButton::hover{background-color: rgb(184, 184, 184);border: 1px solid #6f6f6f;}
QPushButton::pressed{background-color: rgb(135, 135, 135);}
</string>
</property>
<property name="text">
<string>Delete point</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="newPushButton">
<property name="styleSheet">
Expand Down

0 comments on commit 6100681

Please sign in to comment.