Skip to content

Commit

Permalink
Properly update angles when choosing one
Browse files Browse the repository at this point in the history
In the drop-down in the view status. Previously, if the angle was at
45.23 degrees and you tried to set it to 45 degrees, it would get
ignored because the fraction was rounded off in the box.
  • Loading branch information
askmeaboutlo0m committed Jan 26, 2025
1 parent 0ff2daf commit 38a1c89
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Unreleased Version 2.2.2-pre
* Fix: Properly save background color of annotations in ORA files.
* Feature: Allow toggling a "sketch mode" on layers, which will change the opacity and/or tint the layer locally. The exact look of this can be configured in the layer properties. Thanks abrasivetroop and leandro2222 for suggesting.
* Feature: Use the sketch mode tinting for onion skins as well, since it gives better results when there's colored areas involved.
* Fix: Properly update rotation when choosing an angle from the drop-down in the status bar when the angle is fractionally off the chosen angle. Thanks annoy for reporting.

2024-11-06 Version 2.2.2-beta.4
* Fix: Solve rendering glitches with selection outlines that happen on some systems. Thanks xxxx for reporting.
Expand Down
19 changes: 10 additions & 9 deletions src/desktop/widgets/viewstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,21 @@ ViewStatus::ViewStatus(QWidget *parent)
m_angleBox->setEditable(true);
m_angleBox->setToolTip(tr("Canvas Rotation"));

// Trailing spaces so that these always emit editTextChanged.
m_angleBox->addItems({
QStringLiteral("-135°"),
QStringLiteral("-90°"),
QStringLiteral("-45°"),
QStringLiteral(""),
QStringLiteral("45°"),
QStringLiteral("90°"),
QStringLiteral("135°"),
QStringLiteral("180°"),
QStringLiteral("-135° "),
QStringLiteral("-90° "),
QStringLiteral("-45° "),
QStringLiteral(" "),
QStringLiteral("45° "),
QStringLiteral("90° "),
QStringLiteral("135 °"),
QStringLiteral("180 °"),
});
m_angleBox->setEditText(QStringLiteral(""));

m_angleBox->lineEdit()->setValidator(new QRegularExpressionValidator(
QRegularExpression("-?[0-9]{0,3}°?"), this));
QRegularExpression("\\A\\s*-?[0-9]{0,3}°?\\s*"), this));
connect(
m_angleBox, &QComboBox::editTextChanged, this,
&ViewStatus::angleBoxChanged);
Expand Down

0 comments on commit 38a1c89

Please sign in to comment.