Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PointSymbolEditorWidget: Don't duplicate CurveStart property #2093

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/gui/symbols/point_symbol_editor_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,11 +766,19 @@ void PointSymbolEditorWidget::addCoordClicked()
if (coords_table->currentRow() < 0)
path->addCoordinate(MapCoordVector::size_type(coords_table->rowCount()), MapCoord(0, 0));
else
path->addCoordinate(MapCoordVector::size_type(coords_table->currentRow()) + 1, path->getCoordinate(MapCoordVector::size_type(coords_table->currentRow())));
{
auto coord_index = MapCoordVector::size_type(coords_table->currentRow());
auto current_coord = path->getCoordinate(coord_index);
if (current_coord.isCurveStart())
current_coord.setCurveStart(false);
path->addCoordinate(coord_index, current_coord);
}

int row = (coords_table->currentRow() < 0) ? coords_table->rowCount() : (coords_table->currentRow() + 1);
updateCoordsTable(); // NOTE: incremental updates (to the curve start boxes) would be possible but mean some implementation effort
coords_table->setCurrentItem(coords_table->item(row, coords_table->currentColumn()));
map->updateAllObjectsWithSymbol(symbol);
emit symbolEdited();
}

void PointSymbolEditorWidget::deleteCoordClicked()
Expand Down Expand Up @@ -837,7 +845,11 @@ void PointSymbolEditorWidget::updateCoordsTable()
if (num_rows > 0 && path->parts().front().isClosed())
--num_rows;
if (path->getSymbol()->getType() == Symbol::Line)
{
const QSignalBlocker blocker(line_closed_check);
line_closed_check->setChecked(num_rows > 0 && path->parts().front().isClosed());
line_closed_check->setEnabled(num_rows > 0);
}
}

coords_table->setRowCount(num_rows);
Expand Down