Skip to content

Commit

Permalink
QStaticText: mark constructor as explicit
Browse files Browse the repository at this point in the history
A QStaticText object is supposed to be created and *kept* by the user,
and then used repeatedly for drawing, saving the expensive
layouting/rasterization process which would otherwise be done for each
drawText-like call.

Allowing an implicit conversion from QString is therefore surely
unwanted.

[ChangeLog][Potentially Source-Incompatible Changes][QStaticText] The
QStaticText(const QString &) constructor is now explicit.

Change-Id: Ib939a5f46638cb9a54d1cc30ff50e3a9d20be5e4
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
  • Loading branch information
dangelog committed Apr 5, 2017
1 parent 8930243 commit 49c4c06
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui/text/qstatictext.h
Expand Up @@ -62,7 +62,7 @@ class Q_GUI_EXPORT QStaticText
};

QStaticText();
QStaticText(const QString &text);
explicit QStaticText(const QString &text);
QStaticText(const QStaticText &other);
#ifdef Q_COMPILER_RVALUE_REFS
QStaticText &operator=(QStaticText &&other) Q_DECL_NOTHROW { swap(other); return *this; }
Expand Down

0 comments on commit 49c4c06

Please sign in to comment.