Skip to content

Commit

Permalink
QtFontStyle: Add missing const to non-mutable operators
Browse files Browse the repository at this point in the history
and once I touch these lines anyways, either add noexcept ;)
Fixes-up 8bdbb7f

Change-Id: Ibfaedcff82c041293220408ab7ae739b3cbd2a4f
Reviewed-by: Eskil Abrahamsen Blomfeldt <[email protected]>
  • Loading branch information
KonstantinRitt committed Aug 12, 2020
1 parent 1d4457d commit 9594622
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/gui/text/qfontdatabase_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ struct Q_GUI_EXPORT QtFontStyle
signed int weight : 8;
signed int stretch : 12;

bool operator==(const Key &other)
bool operator==(const Key &other) const noexcept
{
return (style == other.style && weight == other.weight &&
(stretch == 0 || other.stretch == 0 || stretch == other.stretch));
}

bool operator!=(const Key &other)
bool operator!=(const Key &other) const noexcept
{
return !operator==(other);
}

bool operator<(const Key &o)
bool operator<(const Key &o) const noexcept
{
int x = (style << 12) + (weight << 14) + stretch;
int y = (o.style << 12) + (o.weight << 14) + o.stretch;
Expand Down

0 comments on commit 9594622

Please sign in to comment.